您好,登錄后才能下訂單哦!
這篇文章主要介紹“Oracle修改控制文件路徑的方法”,在日常操作中,相信很多人在Oracle修改控制文件路徑的方法問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”O(jiān)racle修改控制文件路徑的方法”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!
控制文件----二進(jìn)制文件,在數(shù)據(jù)庫啟動(dòng)和數(shù)據(jù)庫運(yùn)行中有著巨大的作用
參數(shù)文件----pfile 可文本編輯
spfile 二進(jìn)制文件,不可文本編輯
下面介紹兩種修改控制文件兩種方法
################ 1 #####################
如果在startup里指定了pfile=''的話,Oracle將從你指定的文件作為啟動(dòng)參數(shù)文件,如果是沒有指定pfile的話,Oracle會(huì)先去默認(rèn)目錄($ORACLE_HOME/)下找spfileSID.ora,如果沒有找到,則找spfile.ora,如果還是沒有,找initSID.ora,這個(gè)就是以前的靜態(tài)參數(shù)文件了,如果沒有則找init.ora;如果沒有找到的話,這時(shí)候,啟動(dòng)就會(huì)有,找不到參數(shù)文件的錯(cuò)誤,同時(shí)會(huì)動(dòng)態(tài)注冊實(shí)例名到監(jiān)聽服務(wù)里。
把對應(yīng)的controlfile移動(dòng)到目標(biāo)路徑下,由于control01.ctl的路徑?jīng)]有發(fā)生變動(dòng)所以mv:提示不影響操作
[oracle@sink dbs]$ mv /u01/app/oracle/oradata/sink/control01.ctl /u01/app/oracle/oradata/sink/control01.ctl
mv: `/u01/app/oracle/oradata/sink/control01.ctl' and `/u01/app/oracle/oradata/sink/control01.ctl' are the same file
[oracle@sink dbs]$ mv /u01/app/oracle/fast_recovery_area/sink/control02.ctl /u01/app/oracle/oradata/sink/control02.ctl
一定要先關(guān)閉數(shù)據(jù)庫之后才移動(dòng)控制文件,不然會(huì)后面會(huì)出一系列錯(cuò)誤
13:35:03 SYS @ sink >shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
13:36:03 SYS @ sink >
到$ORACLE_HOME/dbs路徑下vim編輯控制文件路徑 然后 :wq 保存退出(w 保存 q 退出 q! 強(qiáng)制退出)
[oracle@sink dbs]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[oracle@sink dbs]$ vim initsink.ora
*.audit_file_dest='/u01/app/oracle/admin/sink/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/u01/app/oracle/oradata/sink/control01.ctl','/u01/app/oracle/oradata/sink/control02.ctl'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
剛我們修改了pfile但是spfile還沒有改動(dòng),所以先指定使用pfile啟動(dòng)數(shù)據(jù)庫
13:41:29 SYS @ sink >startup pfile=$ORACLE_HOME/dbs/initsink.ora
ORACLE instance started.
Total System Global Area 835104768 bytes
Fixed Size 2257840 bytes
Variable Size 553651280 bytes
Database Buffers 276824064 bytes
Redo Buffers 2371584 bytes
Database mounted.
Database opened.
13:42:13 SYS @ sink >
查看此時(shí)的controlifle的路徑信息,好了,沒錯(cuò),那么這么pifle是成功的
13:42:13 SYS @ sink >col name for a55
13:43:50 SYS @ sink >select name from v$controlfile;
NAME
-------------------------------------------------------
/u01/app/oracle/oradata/sink/control01.ctl
/u01/app/oracle/oradata/sink/control02.ctl
2 rows selected.
Elapsed: 00:00:00.00
13:44:01 SYS @ sink >
用pfile生成spifle,因?yàn)閜file成功了,但是spifle還沒有被修改,還沒有生效,默認(rèn)以spfile啟動(dòng),所以此操作合理
13:44:01 SYS @ sink >create spfile from pfile;
File created.
Elapsed: 00:00:00.02
13:46:59 SYS @ sink >
PS : 如果數(shù)據(jù)庫以spfile啟動(dòng),然后你在執(zhí)行 create spfile from pfile 則會(huì)報(bào)錯(cuò) ORA-32002: cannot create SPFILE already being used by the instance |
數(shù)據(jù)庫正常關(guān)閉,然后,startup 不指定任何參數(shù)而數(shù)據(jù)庫又存在spfile,所以oracle 默認(rèn) 以 spfile啟動(dòng)
13:46:59 SYS @ sink >shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
13:52:08 SYS @ sink >startup
ORACLE instance started.
Total System Global Area 835104768 bytes
Fixed Size 2257840 bytes
Variable Size 553651280 bytes
Database Buffers 276824064 bytes
Redo Buffers 2371584 bytes
Database mounted.
Database opened.
13:52:22 SYS @ sink >
啟動(dòng)后,查詢控制文件路徑,發(fā)現(xiàn)成功轉(zhuǎn)移,故修改控制文件路徑成功
13:52:22 SYS @ sink >select name from v$controlfile;
NAME
-------------------------------------------------------
/u01/app/oracle/oradata/sink/control01.ctl
/u01/app/oracle/oradata/sink/control02.ctl
2 rows selected.
Elapsed: 00:00:00.00
13:53:51 SYS @ sink >
到此,關(guān)于“Oracle修改控制文件路徑的方法”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識,請繼續(xù)關(guān)注億速云網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。