oracle 倒庫命令

2021-06-19 01:21:45 字數 911 閱讀 2591

在本地匯出匯入遠端資料庫:

exp 使用者名稱/密碼@遠端庫本機別名 file=d:\\biao.dmp(遠端庫本機別名如:orcl) //匯出遠端資料庫,注意命令不以分號結尾

imp 使用者名稱/密碼@遠端庫本機別名 file=d:\\biao.dmp full=y(遠端庫本機別名如:orcl)  //匯入到遠端資料庫,注意命令不以分號結尾

匯出本地資料庫: 

exp 使用者名稱/密碼 file=d:\\biao.dmp  //匯出本地資料庫,注意命令不以分號結尾

imp 使用者名稱/密碼 file=檔案路徑 full=y  //匯入到本地資料庫,注意命令不以分號結尾

注意:匯入匯出時不要以分號結尾。

首先要在cmd下輸入命令:sqlplus "sys/sys@遠端庫本機別名 as sysdba"  //以管理員身份登入遠端資料庫例項,如果是本地資料庫,則需要去掉@遠端庫本機別名,千萬不要忘了寫雙引號,否則連線不上。

drop user 使用者名稱 cascade;   //刪掉已有使用者(如果存在同名資料庫執行此部)

create user 使用者名稱identified by "密碼" default tablespace users temporary tablespace temp;  //為本地或遠端資料庫例項建立使用者

grant connect,dba,resource to 使用者名稱;  //為新使用者授權

exit;

說明:如果連線本地資料庫例項,則只需要去掉@遠端庫本機別名即可,遠端資料庫別名是用資料庫客戶端在本地配置的名字,用來唯一標識遠端資料庫例項。

延伸:可以匯出乙個使用者的所有表和資料,然後再把這些資訊匯入另乙個使用者的表空間內,即匯入和匯出命令中的檔案相同,但是使用者名稱和密碼不同。

注意事項:以上命令都可在cmd控制台下使用,但是剛建立完使用者,最好是重新打卡cmd視窗,再執行匯入或匯出命令。

oracle資料庫命令

oracle資料庫命令 1.資料庫啟動,登陸資料庫 sqlplus as sysdba 2.開啟資料庫 startup 3.建立表 create table team id int,name varchar 50 varchar 10 4.刪除表 drop table team 5.插入 inser...

Oracle資料庫命令介紹

1 設定當前 session 是否對修改的資料進行自動提交 sql set auto commit 2 在用 start 命令執行乙個 sql 指令碼時,是否顯示指令碼中正在執行的 sql 語句 sql set echo 3 是否顯示當前 sql 語句查詢或修改的行數 sql set feed ba...

資料庫命令

mysql常用命令 show databases use manage create table user name varchar 20 password varchar 20 age int describe user insert into user values admin admin 10...