imp導出:
exp 用戶名/密碼@服務名 file=路徑\名稱.dmp log=路徑\名稱.log
例$exp example/password@orcl file=E:\example20161130.dmp log=E:\example20161130.log;
imp導入:
imp system/password@服務名 file=路徑\名\稱.dmp log=路徑\名稱.log fromuser=原用戶名 touser=現在用戶名 ignore=y commit=y;
例:$imp system/system@orcl file=e:\demo.dmp log=e:\demo.log fromuser=demoFromUser touser=demoToUser ignore=y commit=y ;
這裏可以跨用戶導入,fromuser touser,用戶名可以不同。
創建表空間的腳本文件內容及解釋
Create tablespace space1 datafile 'E:\oracle\product\10.2.0\oradata\orcl\space1.dbf' size 100M autoextend on next 10M maxsize unlimited;
例 create tablespace space1 logging datafile 'E:\oradata\space1.dbf' size 300m autoextend on next 300m maxsize 20480m extent management local;
說明:在路徑D:\oracle\oradata\ORCL下創建表空間,
命名爲space1.dbf,空間500兆(表空間所屬路徑必須位於oracle實例路徑下,當前實例爲orcl)
當表空間容量不足時,以100M容量遞增且不限最大使用空間,理論上是硬盤的最大空間。
建立用戶代碼
create user example identified by password
default tablespace space1
temporary tablespace temp
quota unlimited on space1;
用戶授權代碼
若是ORACLE10G,先執行:
grant create view to connect;
grant connect,resource to example;
grant create database link to example;
grant debug connect session to example;
用戶連接代碼:connect example/password@orcl;
刪除用戶代碼:drop user XX cascade;
如果刪不掉,則用下面的方式。
SQL>select sid,serial#,username,machine,osuser from v$session where username = 'example'; --刪除example這個用戶,查處用戶連接的情況
SQL> alter system kill session 'sid,serial#'; --把查找出來的會話中止
SQL>drop user example cascade; --此時就可以通過此命令把用戶刪除
修改密碼:
update utusrmst set newusr_pwd='7f3200157a118247076e66494f60c384' where usr_id like 'SYS';
commit;
在cmd中使用sql:
sqlplus /nolog
conn / as sysdba
進入dos,輸入 sqlplus /nolog
輸入: conn as / sysdba; 示例:conn gis/gis as sysdba;
解鎖用戶:alter user system account unlock;
更改密碼:alter user system identified by system;