10204 RAC on aix 5.3 更改hostname,sid,databa name
有個新系統實施,不想重灌,想通過直接更改hostname,sid,database name 方法來直接讓測試庫先頂替。(此處不討論與重灌的效率問題),下面是整個過程遇到的零零碎碎的
記錄。
更改aix rac 資料庫hostname, sid 及 db_name
database name:uip->imscmdb
instance name::uip1->imscmdb1 ,uip2->imscmdb2
hostname: uiprac1,uiprac2->imsrac1,imsrac2
以下操作均在node1上操作:
一、確認rac 狀態
首先來看看RAC的狀態:
[root@rac1 tmp]# /u01/app/crs/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.imscmdb.db application ONLINE ONLINE imsrac1
ora....b1.inst application ONLINE ONLINE imsrac1
ora....b2.inst application ONLINE ONLINE imsrac2
ora....C1.lsnr application ONLINE ONLINE imsrac1
ora....ac1.gsd application ONLINE ONLINE imsrac1
ora....ac1.ons application ONLINE ONLINE imsrac1
ora....ac1.vip application ONLINE ONLINE imsrac1
ora....C2.lsnr application ONLINE ONLINE imsrac1
ora....ac2.gsd application ONLINE ONLINE imsrac2
ora....ac2.ons application ONLINE ONLINE imsrac2
ora....ac2.vip application ONLINE ONLINE imsrac2
ora.rac2.ons application ONLINE ONLINE imsrac2
ora.rac2.vip application ONLINE ONLINE imsrac2
二、修改sid和db_name
現在RAC狀態一切正常,所有服務已經啟動。下面來試下如何修改2臺RAC機器的SID,分別修改為:imsrac1, imsrac2
1.建立pfile,然後把uip1--->imscmdb1, uip2--->imscmdb2,並傳輸給另外一個節點,其他引數不任何變更
SQL> conn /as sysdba
Connected.
SQL> create pfile='/tmp/pfile' from spfile;
File created.
[oracle@rac1 companion]$ scp /tmp/pfile 10.128.7.102:/tmp
pfile 100% 1290 1.3KB/s 00:00
[oracle@rac1 companion]$ cat /tmp/pfile
imscmdb1.__db_cache_size=4060086272
imscmdb2.__db_cache_size=4060086272
imscmdb1.__java_pool_size=16777216
imscmdb2.__java_pool_size=16777216
imscmdb1.__large_pool_size=16777216
imscmdb2.__large_pool_size=16777216
imscmdb1.__shared_pool_size=855638016
imscmdb2.__shared_pool_size=855638016
imscmdb1.__streams_pool_size=0
imscmdb2.__streams_pool_size=0
*.audit_file_dest='/u01/oracle/admin/uip/adump'
*.background_dump_dest='/u01/oracle/admin/uip/bdump'
*.cluster_database=true
*.cluster_database_instances=2
*.compatible='10.2.0.1.0'
*.control_files='/dev/ruip_control1','/dev/ruip_control2','/dev/ruip_control3'
*.core_dump_dest='/u01/oracle/admin/uip/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='imscmdb'
imscmdb1.instance_number=1
imscmdb2.instance_number=2
*.job_queue_processes=10
imscmdb1.local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = 10.128.7.100)(PORT = 1521)(IP = FIRST))'
imscmdb2.local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = 10.128.7.102)(PORT = 1521)(IP = FIRST))'
*.log_archive_dest_1='LOCATION=/archlog'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=1653604352
*.processes=150
*.remote_listener='LISTENERS_ims' ---此處在tnsnnames.ora可看到
*.remote_login_passwordfile='exclusive'
*.sga_target=167772160
imsrac2.thread=2
imsrac1.thread=1
*.undo_management='AUTO'
imsrac1.undo_tablespace='UNDOTBS1'
imsrac2.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/u01/app/oracle/admin/ims/udump'
2. 停止2臺節點的資料庫(2個節點執行,當然也可以使用srvctl stop all 或crs_stop -all)
SQL> conn /as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
再來看看狀態:
[root@rac1 tmp]# /u01/app/crs/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.imscmdb.db application OFFLINE OFFLINE imsrac1
ora....b1.inst application OFFLINE OFFLINE imsrac1
ora....b2.inst application OFFLINE OFFLINE imsrac2
ora....C1.lsnr application ONLINE ONLINE imsrac1
ora....ac1.gsd application ONLINE ONLINE imsrac1
ora....ac1.ons application ONLINE ONLINE imsrac1
ora....ac1.vip application ONLINE ONLINE imsrac1
ora....C2.lsnr application ONLINE ONLINE imsrac1
ora....ac2.gsd application ONLINE ONLINE imsrac2
ora....ac2.ons application ONLINE ONLINE imsrac2
ora....ac2.vip application ONLINE ONLINE imsrac2
ora.rac2.ons application ONLINE ONLINE imsrac2
ora.rac2.vip application ONLINE ONLINE imsrac2
可以看到instance都已經停止。
3.修改 .bash_profile的ORACLE_SID的環境變數,其他的不需要修改(2個節點)
export ORACLE_SID=imsrac1
export ORACLE_SID=imsrac2
4. 通過pfile啟動資料庫(2個節點執行)
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup pfile='/tmp/pfile';
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 88082676 bytes
Database Buffers 75497472 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
再檢視相關RAC狀態:
[root@rac1 tmp]# /u01/app/crs/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.imscmdb.db application OFFLINE OFFLINE imsrac1
ora....b1.inst application OFFLINE OFFLINE imsrac1
ora....b2.inst application OFFLINE OFFLINE imsrac2
ora....C1.lsnr application ONLINE ONLINE imsrac1
ora....ac1.gsd application ONLINE ONLINE imsrac1
ora....ac1.ons application ONLINE ONLINE imsrac1
ora....ac1.vip application ONLINE ONLINE imsrac1
ora....C2.lsnr application ONLINE ONLINE imsrac1
ora....ac2.gsd application ONLINE ONLINE imsrac2
ora....ac2.ons application ONLINE ONLINE imsrac2
ora....ac2.vip application ONLINE ONLINE imsrac2
ora.rac2.ons application ONLINE ONLINE imsrac2
ora.rac2.vip application ONLINE ONLINE imsrac2
可以看到,雖然啟動,但是由於OCR資訊並沒有修改,所有CRS顯示出來並不正確。接下來就是要更新OCR的資訊。
在修改之前,先來做個測試:
在RAC1執行;
SQL> create table test(id number);
Table created.
SQL> insert into test values(1);
1 row created.
SQL> commit;
Commit complete.
在RAC2檢視是否有問題:
SQL> select * from test;
ID
----------
1
再繼續看:
SQL> show parameter instance_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string imsrac1
SQL> show parameter instance_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string imsrac2
可以看到,資料庫中instance_name已經修改了。
--清空ocr和votedisk
CRS_OCR_LOCATIONS=/dev/rocr1,/dev/rocr2
CRS_VOTING_DISKS=/dev/rvote1,/dev/rvote2,/dev/rvote3
dd if=/dev/zero f=/dev/rocr1 bs=1M count=200
dd if=/dev/zero f=/dev/rocr2 bs=1M count=200
dd if=/dev/zero f=/dev/rvote1 bs=1M count=200
dd if=/dev/zero f=/dev/rvote2 bs=1M count=200 --如果crs服務沒有停止,主機會重啟,理論來至oracle官方,votedisk少於一半的時候節點會全部重啟
dd if=/dev/zero f=/dev/rvote3 bs=1M count=200
--設定2節點互信
cat rsa_id.pub >> authorized_key
scp authorized_key 到node1 ,再從node2scp到node1 詳見安裝說明(不贅述).
5. 最後就是更新OCR
首先先移除原來的SID資訊:
先移除資料庫註冊資訊
Srvctl remove databse –d uip
再移除資料庫例項註冊資訊
[oracle@rac1 ~]$ srvctl remove instance -d uip -i uip1
Remove instance uip1 from the database uip? (y/[n]) y
[oracle@rac1 ~]$ srvctl remove instance -d uip -i uip2
Remove instance uip2 from the database uip? (y/[n]) y
檢視CRS狀態:
[root@rac1 tmp]# /u01/app/crs/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.imscmdb.db application OFFLINE OFFLINE
ora....b1.inst application OFFLINE OFFLINE
ora....b2.inst application OFFLINE OFFLINE
ora....C1.lsnr application ONLINE ONLINE imsrac1
ora....ac1.gsd application ONLINE ONLINE imsrac1
ora....ac1.ons application ONLINE ONLINE imsrac1
ora....ac1.vip application ONLINE ONLINE imsrac1
ora....C2.lsnr application ONLINE ONLINE imsrac1
ora....ac2.gsd application ONLINE ONLINE imsrac2
ora....ac2.ons application ONLINE ONLINE imsrac2
ora....ac2.vip application ONLINE ONLINE imsrac2
6、資訊已經移除,接下來就是重新註冊新的instance了。
注意:
若此時需要更改主機名需要同時更改主機ha 的配置、oracle 更改publica node name
[oracle@rac1 ~]$srvctl add database -d imscmdb -o
[oracle@rac1 ~]$ srvctl add instance -d imscmdb -i imscmdb1 -n imsrac1
[oracle@rac1 ~]$ srvctl add instance -d imscmdb -i imscmdb2 -n imsrac2
檢視CRS狀態:
7、netca配置監聽:(過程略)
[root@rac1 tmp]# /u01/app/crs/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.imscmdb.db application OFFLINE OFFLINE
ora....b1.inst application ONLINE ONLINE imsrac1
ora....b2.inst application ONLINE ONLINE imsrac2
ora....C1.lsnr application ONLINE ONLINE imsrac1
ora....ac1.gsd application ONLINE ONLINE imsrac1
ora....ac1.ons application ONLINE ONLINE imsrac1
ora....ac1.vip application ONLINE ONLINE imsrac1
ora....C2.lsnr application ONLINE ONLINE imsrac1
ora....ac2.gsd application ONLINE ONLINE imsrac2
ora....ac2.ons application ONLINE ONLINE imsrac2
ora....ac2.vip application ONLINE ONLINE imsrac2
--已經註冊成功,可以發現instance變為imsrac1,imsrac2了。
/**注:清空ocr盤跟votedisk資訊後,我的listener配置經歷了痛苦的過程:**/
/**最終用netca重新配置,開始沒有成功,一直提示 tns-04406 object already exists 其他監聽已啟動,**/
/**我直接用netca 把老的刪除,重配,N次後成功!(這裡確實無解- -!)這裡我直接在node1上操作,**/
/**此時database跟2各例項是起不來的,因為控制檔案中記得還是uip(老的database name)**/
8、建立控制檔案
/**另:需要注意的是,我需要把資料庫mount上才能做:alter databae backup controlfile to trace as '/tmp/cf.sql'**/
/**這裡,我選擇了老的pfile檔案,先把資料庫mount上後,再備份控制檔案,這也是我開始做create pfile from spfile的原因之一。**/
9、alter databae backup controlfile to trace as '/tmp/cf.sql'
10、 更改db_name,下面的指令碼來之cf.sql 開始用 reuse 。。。noresetlogs會提示 ora-12720錯誤。錯誤如下:
SQL> STARTUP pfile='/tmp/pfile' NOMOUNT
CREATE CONTROLFILE reuse DATABASE "IMSCMDB" NORESETLOGS ARCHIVELOG
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 32
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/dev/ruip_redo1_1' SIZE 50M,
GROUP 2 '/dev/ruip_redo1_2' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/dev/ruip_system',
'/dev/ruip_undotbs1',
'/dev/ruip_sysaux',
'/dev/ruip_undotbs2',
'/dev/ruip_users'
CHARACTER SET ZHS16GBK;
ORACLE instance started.
Total System Global Area 4966055936 bytes
Fixed Size 2090824 bytes
Variable Size 889194680 bytes
Database Buffers 4060086272 bytes
Redo Buffers 14684160 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "IMSCMDB" NORESETLOGS ARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-12720: operation requires database is in EXCLUSIVE mode
/**上面 ORA-12720錯誤提示是因為rac 有個引數cluster_database 設了true 即,叢集需要2個節點同時更改,故現在不顯示**/
/**且當初修改database_name的時候我依然用的reuse 這會提示 ora-01161錯誤,此處必須用set ,設定new database。**/
/**這是基礎,修改:alter system set cluster_database=false scope=spfile sid='*';**/
SQL> CREATE CONTROLFILE set DATABASE "IMSCMDB" RESETLOGS ARCHIVELOG
2 MAXLOGFILES 192
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 1024
5 MAXINSTANCES 32
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 '/dev/ruip_redo1_1' SIZE 50M,
9 GROUP 2 '/dev/ruip_redo1_2' SIZE 50M
10 -- STANDBY LOGFILE
11 DATAFILE
12 '/dev/ruip_system',
13 '/dev/ruip_undotbs1',
14 '/dev/ruip_sysaux',
15 '/dev/ruip_undotbs2',
16 '/dev/ruip_users'
17 CHARACTER SET ZHS16GBK;
Control file created.
SQL> startup mount
ORACLE instance started.
Total System Global Area 4966055936 bytes
Fixed Size 2090824 bytes
Variable Size 889194680 bytes
Database Buffers 4060086272 bytes
Redo Buffers 14684160 bytes
Database mounted.
--ok,控制檔案建立完成,資料庫自動mount
11、嘗試開啟資料庫,上面建立控制檔案指令碼是用resetlogs建立的,故用resetlogs open;
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-38856: cannot mark instance imscmdb2 (redo thread 2) as enabled
/**發現alter database backup controlfile to trace as '/xx.sql'
生成的trace檔案中的set#1(noresetlogs)跟set#2(resetlogs),
對redo的處理其實不一樣,2只是1的standby。故這裡需要重新新增一組(thread2)的redo即可**/
mount狀態下新增,方法如下:
alter database add logfile thread 2
GROUP 3 '/dev/ruip_redo2_1' SIZE 50M,
GROUP 4 '/dev/ruip_redo2_2' SIZE 50M;
alter database open resetlogs;
---成功
alter system set cluster_database=true scope=spfile sid='*';
12、 在node2: 調整由spfile 自動啟動
重建SPFILE檔案的步驟
可以用create spfile from pfile='/tmp/pfile';來覆蓋
因為如果這個引數沒有調整,如果你使用crs_start -all啟動crs資源, 這個節點如果是自動啟動,會失敗;
[root@racdb1 bin]# ./srvctl start database -d imscmdb 或者 crs_start -all
13、 觀察crs 狀態
$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.imscmdb.db application ONLINE ONLINE imsrac1
ora....b1.inst application ONLINE ONLINE imsrac1
ora....b2.inst application ONLINE ONLINE imsrac2
ora....C1.lsnr application ONLINE ONLINE imsrac1
ora....ac1.gsd application ONLINE ONLINE imsrac1
ora....ac1.ons application ONLINE ONLINE imsrac1
ora....ac1.vip application ONLINE ONLINE imsrac1
ora....C2.lsnr application ONLINE ONLINE imsrac2
ora....ac2.gsd application ONLINE ONLINE imsrac2
ora....ac2.ons application ONLINE ONLINE imsrac2
ora....ac2.vip application ONLINE ONLINE imsrac2
全部正常,因為這個rac 用的是裸裝置,spfile看下在哪兒
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/oracle/db/dbs/spfileimscm
--理論上應該是指向:/dev/rxxx_spfile.
以後再處理!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22907091/viewspace-716224/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 10204 64 bit on aix 5.3 nbu 備份問題OracleAI
- 更改資料庫SID名和db_name名資料庫
- ubuntu 18.04 更改 hostnameUbuntu
- Oracle SID VS Service NameOracle
- Oracle SID & SERVICE_NAMEOracle
- AIX 5.3 Install Oracle 10g RAC 錯誤集錦AIOracle 10g
- DB_NAME&TANCE_NAME&DB_UNIQUE_NAME&ORACLE_SID&GLOBAL_NAME&DB_DOMAIN&SERVICE_NAMEOracleAI
- AIX5.3 HACMP5.3環境Oracle10gR2 RAC的安裝日記AIACMOracle
- oracle sid,instance_name,db_name,oracle_sid之間的關係Oracle
- ORACLE_SID,INSTANCE_NAME和DB_NAMEOracle
- DB_NAME DB_UNIQUE_NAME 和 SID 的理解
- 一、更改ORACLE SID名稱Oracle
- AIX5300-08 HACMP5.4.1 ORACLE10204 RAC 安裝(6)AIACMOracle
- AIX5300-08 HACMP5.4.1 ORACLE10204 RAC 安裝(5)AIACMOracle
- AIX5300-08 HACMP5.4.1 ORACLE10204 RAC 安裝(4)AIACMOracle
- AIX5300-08 HACMP5.4.1 ORACLE10204 RAC 安裝(3)AIACMOracle
- AIX5300-08 HACMP5.4.1 ORACLE10204 RAC 安裝(2)AIACMOracle
- AIX5300-08 HACMP5.4.1 ORACLE10204 RAC 安裝(1)AIACMOracle
- AIX5300-08 HACMP5.4.1 ORACLE10204 RAC 安裝(7)AIACMOracle
- AIX5.3安裝sshAI
- aix5.3 安裝 opensshAI
- 更改Global_name, domain_name, db_name 的方法AI
- AIX5.3安裝RAC Oracle10.2.0.1時被忽略的組hagsuserAIOracle
- SID、ORACLE_SID、INSTANCE_NAME、DB_NAME、SERVER_NAMES、GLOBAL_DBNAME等區別OracleServer
- 更改Oracle資料庫的SIDOracle資料庫
- instance_name、db_name、ORACLE_SID、db_name等的區別Oracle
- AIX 5.3主機效能評估AI
- oracle 11g 更改sid和dbnameOracle
- AIX 5.3/6.1環境下安裝Oracle 10gR2 RAC常見報錯AIOracle 10g
- 提醒大家,不要AIX5.3ML05+10.2.0.2RAC 這樣組合問題很大。。AI
- AIX5,3 oracle 10201升10204 rac補丁 誤操作記錄AIOracle
- OS(AIX5.3)系統檢查AI
- aix5.3安裝openssl和opensshAI
- Aix5.3安裝Bash環境AI
- ibm aix 5.3學習筆記IBMAI筆記
- [轉]ORACLE中的DB_NAME,SERVICE_NAME,INSTANCE_NAME,ORACLE_SID,GLOBAL_DBNAMEOracle
- The database owner SID recorded in the master database differs from the database owner SID recorded in database 'DB_NAME'DatabaseAST
- AIX5.3ML05+Oracle 10.2.0.2 RAC 結合的一個大問題解決AIOracle