oracle數(shù)據(jù)庫(kù)開(kāi)啟關(guān)閉,監(jiān)聽(tīng)配置,導(dǎo)入導(dǎo)出

https://www.cnblogs.com/yanch/p/8676445.html

1. 數(shù)據(jù)庫(kù)登錄后的開(kāi)啟和關(guān)閉

[oracle@localhost /]$ sqlplus / as sysdba



SQL> conn as sysdba



SQL> startup

SQL> shutdown immediate


2. 監(jiān)聽(tīng)的啟動(dòng)和關(guān)閉以及狀態(tài)查詢

lsnrctl start
會(huì)看到啟動(dòng)成功的界面;
lsnrctl stop
停止監(jiān)聽(tīng)器命令.
lsnrctl status
查看監(jiān)聽(tīng)器命令.

一. linux下啟動(dòng)oracle
su - oracle
sqlplus /nolog
conn /as sysdba
startup
exit
lsnrctl start
exit
二. linux下關(guān)閉oracle
su - oracle
sqlplus /nolog
conn /as sysdba
shutdown immediate
exit
lsnrctl stop
exit

4.數(shù)據(jù)庫(kù)的命令導(dǎo)入導(dǎo)出

1、 oracle導(dǎo)出 準(zhǔn)備

關(guān)鍵一步:

創(chuàng)建一個(gè)目錄文件夾,

mkdir /home/expfolder

導(dǎo)入數(shù)據(jù)庫(kù)后需要進(jìn)行賦予權(quán)限****,****可讀可寫可執(zhí)行。

chmod -R 777 /home/expfolder

exp 用戶名/密碼@數(shù)據(jù)庫(kù)ip/數(shù)據(jù)庫(kù)sid file=“文件路徑及文件名” log =“文件路徑及文件名” [full=y] [owner="aaa"] [tables=(table)];

(1)交互式命令行方式

exp username(用戶名)/password(口令)@servicename(數(shù)據(jù)庫(kù)服務(wù)名)

例如

$exp ttt/123@sername
Enter array fetch buffer size: 4096 > 回車
Export file: expdat.dmp > /tmp/exploder/daochu.dmp(生成導(dǎo)出的文件名,跟路徑)
(1)E(ntire database), (2)U(sers), or (3)T(ables): (2)U > 3:table1
1:整個(gè)數(shù)據(jù)庫(kù) 2:所有的用戶,schema 3:所有的表

/3:table1,table2……….導(dǎo)出數(shù)據(jù)庫(kù)指定的表/ Export table data (yes/no): yes > no

是否導(dǎo)出表中的數(shù)據(jù) Compress extents (yes/no): yes > 回車

是否壓縮

Export done in US7ASCII character set and UTF8 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
About to export specified tables via Conventional Path ...
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > t 要導(dǎo)出的表名

. . exporting table t
Table(T) or Partition(T:P) to be exported: (RETURN to quit) >要導(dǎo)出的表名n
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > 回車 Export terminated successfully without warnings.

關(guān)鍵一步:

導(dǎo)入數(shù)據(jù)庫(kù)后需要進(jìn)行賦予權(quán)限****,****可讀可寫可執(zhí)行用于導(dǎo)入操作。

chmod -R 777 /home/expfolder

cd /home/expfolder //進(jìn)入目錄

ll //查看詳情

2、oracle導(dǎo)入

imp 用戶名/密碼@數(shù)據(jù)庫(kù)ip/數(shù)據(jù)庫(kù)實(shí)例 file = '文件路徑和文件名' [full=y] [fromuser =aaa] [touser=aaa] [owner=aaa][ables=(表名)]

案例:



將我們導(dǎo)出的/home/expfolder/t.dmp full=yes完全導(dǎo)入。

三種導(dǎo)入模板:

1.將備份文件daochu.dmp完全導(dǎo)入到數(shù)據(jù)庫(kù)(完全導(dǎo)入)

imp aaa/12345678@192.9.5.127/orcl file=d:/daochu.dmp full=y;

2.把備份文件daochu1.dmp備份到數(shù)據(jù)庫(kù)(用戶模式)

imp aaa/12345678@192.9.5.127/orcl file=d:/daochu1.dmp fromuser=aaa touser = aaa;

3.將備份文件daochu2.dmp中的表導(dǎo)入數(shù)據(jù)庫(kù)(表模式)

imp aaa/12345678@192.9.5.127/orcl file=d:/daochu2.dmp tables=table1,table2………… ;

注:

1、[]內(nèi)內(nèi)容可以省略;

2、full = y 導(dǎo)出或?qū)胍粋€(gè)完整的數(shù)據(jù)庫(kù)

3、fromuser 入一個(gè)或一組指定用戶所屬的全部表、索引和其他對(duì)象

4、touser 將一個(gè)用戶所屬的數(shù)據(jù)導(dǎo)入另一個(gè)用戶

5、[tables=(table)] 導(dǎo)入或?qū)С霰?/p>

6、exp owner=user 將用戶user的對(duì)象導(dǎo)出 imp owner=user 把用戶user的對(duì)象導(dǎo)入

[參考]https://spiritfrog.iteye.com/blog/250266

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容