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)限****,****可讀可寫(xiě)可執(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)限****,****可讀可寫(xiě)可執(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)入