OARACLE——建立表空間、使用者、許可權、刪除使用者、匯入、匯出
阿新 • • 發佈:2018-11-27
1、使用sys使用者登入,連線為SYSDBA;
2、查詢表空間資料資料夾在伺服器上的路徑,得到資料夾的路徑為D:\ORACLE\PRODUCT\10.2.0\ORADATA\YWSJ\;
Select FILE_NAME FROM DBA_DATA_FILES;
3、建立表空間
CREATE TABLESPACE TESTSPACE--表空間名稱 LOGGING DATAFILE 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\YWSJ\TESTSPACE.DBF' --指定資料檔案路徑,該檔案會自動生成 SIZE 200M --初始大小 AUTOEXTEND ON NEXT 32M MAXSIZE UNLIMITED --每次擴充套件大小 EXTENT MANAGEMENT LOCAL;
4、建立使用者並且指定表空間
create user TESTUSER identified by 123456 --指定使用者名稱、密碼
default tablespace TESTSPACE--指定預設表空間
temporary tablespace TEMP;--指定臨時表空間
5、授予使用者許可權
grant create session to TESTUSER;--授予使用者建立session的許可權,即登陸許可權 grant unlimited tablespace to TESTUSER;--授予使用者使用表空間的許可權 grant create any table to TESTUSER;--授予建立表的許可權 grant drop any table to TESTUSER;--授予刪除表的許可權 grant insert any table to TESTUSER;--插入表的許可權 grant update any table to TESTUSER;--修改表的許可權 grant create any sequence to TESTUSER; grant create view to TESTUSER; --授予查詢表許可權 grant select any table to TESTUSER; --授予查詢字典許可權 grant select any dictionary to TESTUSER; --授予連線、資源、管理員許可權 grant connect,resource,dba to TESTUSER;
6、除表空間外的其他資料都刪除(刪除使用者、表、序列、索引、sec)
drop user TESTUSER cascade;
7、匯出匯入,imp在cmd裡面執行,而不是在sqlplus中。可以在客戶端執行。
exp TESTUSER/[email protected]伺服器ip/資料庫名稱 file=F:\TEST0712.dmp owner=(TESTUSER) imp TESTUSER/[email protected]伺服器ip:1521/資料庫名稱 file=F:\1\TEST0712.dmp log=F:\1\TEST0712.log full=y ignore=y statistics=none buffer=5400000 commit=y
鳴謝:何瑤龍