建立表空間 建立使用者 授權 解鎖 查詢等

2021-08-04 09:59:56 字數 1740 閱讀 5637

--建立表空間

reuse autoextend on next 128m maxsize unlimited;

--建立使用者,指定表空間

create user us_ygbp profile default identified by us_ygbp 

default tablespace ts_ygbp account unlock;

--為使用者授權 

grant

connect, resource,

unlimited tablespace,

select any dictionary,

create any sequence,

drop any sequence,

create any table,

drop any table,

create any directory,

drop any directory,

create any index,

drop any index,

create any view

to us_ygbp;

--授予管理員許可權

grant dba to us_ygbi_2017;

--一般資料庫預設是10次嘗試失敗後鎖住使用者

--用dba角色登入,進行解鎖,先設定具體時間格式,以便檢視具體時間

alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

--檢視具體的被鎖時間

select username,lock_date from dba_users where username='us_ygbp';

--解鎖

alter user us_ygbp account unlock;

--修改表空間名稱

alter tablespace  us_ygbi_2017 rename to ts_ygbp;

--查詢所有表空間名

select name from v$tablespace;

--查詢當前使用者名稱和表空間名

select username,default_tablespace from user_users;

--檢視,修改使用者名稱   管理員許可權才能檢視

select user#,name from user$;

update user$ set name='us_ygbi_2017' where user#=85;

--檢視使用者名稱密碼

select username,password from dba_users;

--修改us_ygbi_2017使用者的密碼為us_ygbi_2017

alter user us_ygbi_2017 identified by us_ygbi_2017;

--檢視使用者是否被鎖,並解鎖

select username,lock_date from dba_users where username='us_ygbi_2017';

alter user us_ygbi_2017 account unlock;

--查詢當前資料庫名

select name from v$database;

--查詢當前資料庫例項名

select instance_name from v$instance; 

--刪除使用者及使用者下的所有表結構等

drop user us_ygbi_2017 cascade;

建立表空間 使用者 授權

1 在建立使用者前要先建立表空間 create tablespace 表空間 datafile 資料檔名 size 表空間大小 create tablespace huli datafile d oracle product 10.2.0 oradata myorc.dbfl size 50m 2 ...

建立表空間建立使用者以及使用者授權

建立表空間 create tablespace leon datafile c leon.dbf size 100m autoextend on next 10m 刪除表空間 drop tablespace leon 建立使用者 create user leon identified by leon...

Oracle建立表空間建立使用者授權

注意 sys使用者下執行。sys登入必須為sysdba身份。檢視資料檔案存放位置。select from dba data files 1 建立表空間 create tablespace tp lp datafile d data tp lp01.dbf size 10m autoextend of...