ORACLERAC更改实例名规划后的实例名 fqzdb
ip
fqzdb01 192.168.2.33
fqzdb02 192.168.2.34
2.1.1 扫描磁盘(下⾯的操作没有特别提⽰,默认为两个节点都操作)
在两个节点上使⽤root⽤户执⾏cfgmg命令识别同步过来的存储磁盘
Method error (/usr/lib/methods/cfgpkcs11 -l pkcs11 ):
0514-040 Error initializing a device into the kernel.---------报错可忽略
扫描完成后,系统/dev⽬录下会⽣成hdisk33磁盘
2.1.2 磁盘修改权限
修改磁盘的权限⾄660,属组修改为Oracle⽤户组,打开no_reserve属性
root⽤户在/dev⽬录下执⾏:
chdev -l hdisk2 -a reserve_policy=no_reserve
chdev -l hdisk3 -a reserve_policy=no_reserve
chdev -l hdisk4 -a reserve_policy=no_reserve
chdev -l hdisk5 -a reserve_policy=no_reserve
chmod 660 rhdisk2
chmod 660 rhdisk3
chmod 660 rhdisk4
chmod 660 rhdisk5
chown grid:oinstall rhdisk2
chown grid:oinstall rhdisk3
chown grid:oinstall rhdisk4
chown grid:oinstall rhdisk5
2.1.3 Mount Disk Group
使⽤grid⽤户在两个节点上执⾏
[root@prodb01a /]# su - grid
[grid@prodb01a /home/grid]> sqlplus / as sysasm
SQL*Plus: Release 12.1.0.2.0 Production on Thu Feb 14 11:54:51 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> select name,state from v$asm_diskgroup;
NAME STATE
------------------------------ -----------
DG_fqz_CRS MOUNTED
FQZDATADG DISMOUNTED
SQL> alter diskgroup FQZDATADG mount force;
Diskgroup altered.
2.1.4 启动数据库
Oracle⽤户执⾏
export ORACLE_SID=prodb
sqlplus / as sysdba
SQL> startup pfile='/home/a'
2.2 修改相关名称实施步骤
(本套数据库修改名称定为 prodb )
2.2.1 数据库启动⾄mount状态
RAC需要⾸先将cluster_database置为false后重启数据库⾄mount状态
[oracle@prodb01a /home/oracle]> sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Feb 14 11:05:48 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options
[oracle@prodb01a /home/oracle]> sqlplus / as sysdba
SQL> startup mount
ORACLE instance started.
Total System Global Area 4.2950E+10 bytes
Fixed Size 7727872 bytes
Variable Size 1.3959E+10 bytes
Database Buffers 2.8857E+10 bytes
Redo Buffers 126488576 bytes
Database mounted.
SQL> quit
2.2.2 修改Dbname、Dbid
Oracle⽤户在1节点上使⽤nid命令执⾏
[oracle@prodb01a /home/oracle]> nid target=/ dbname=prodb
DBNEWID: Release 12.1.0.2.0 - Production on Thu Feb 14 11:11:00 2019
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
Connected to database PRODB (DBID=3182511783)
Connected to server version 12.1.0
Control Files in database:
Change database ID and database name PRODB to prodb? (Y/[N]) => y ...........................
Database name changed to prodb
Modify parameter file and generate a new password file before restarting.
Database ID for database prodb changed to 3926312005.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
2.2.3 重启数据库
[oracle@prodb01a /home/oracle]> sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Feb 14 11:12:20 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create pfile=’/home/a’ from spfile=’+PRODBDATA2/a’; SQL>exit
[oracle@prodb01a /home/oracle]> a
修改db_name='prodb'
去掉db_unique_name参数
SQL> startup mount pfile=’/home/a’
ORACLE instance started.
Total System Global Area 4.2950E+10 bytes
Fixed Size 7727872 bytes
Variable Size 1.3959E+10 bytes
Database Buffers 2.8857E+10 bytes
Redo Buffers 126488576 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string prodb
2.2.4 修改pfile中的实例名
1节点实例名prodb1
2节点实例名PRODB
修改参数⽂件(直接使⽤1节点已修改好的参数⽂件/home/a,因此⽆需执⾏此步骤)
[oracle@prodb01a /home/oracle]> sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Feb 14 11:12:20 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to an idle instance.
SQL> shut immediate
SQL>exit
[oracle@prodb01a /home/oracle]> a
修改如下选项
*.db_name='prodb'
*.db_recovery_file_dest=''
prodb1.instance_number=1
PRODB.instance_number=2
prodb1.undo_tablespace='UNDOTBS1'
PRODB.undo_tablespace='UNDOTBS2'
File created.
2.2.5 修改Disk Droup Name
将diskgroup name:BKSERVERDATA 修改为FQZDATADG
Grid两个节点执⾏:
[grid@prodb02a /home/grid]> sqlplus / as sysasm
SQL*Plus: Release 12.1.0.2.0 Production on Thu Feb 14 14:47:50 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> alter diskgroup PRODBDATA2 dismount;
Diskgroup altered.
Grid⽤户在1节点执⾏:
[grid@prodb01a/home/oracle] renamedg phase=both dgname=PRODBDATA2 newdgname=FQZDATADG verbose=true 移除原Disk Group
[grid@prodb01a/home/oracle] srvctl remove diskgroup -g PRODBDATA2 -f
重建控制⽂件并修改其中数据⽂件、⽇志⽂件路径
[oracle@prodb01a/home/oracle] a
修改cluster_database=false
SQL> startup mount pfile=‘/home/a’;
SQL> alter database backup controlfile to trace as ‘/home/l’
SQL>shut immediate
SQL>startup nomount pfile=’/home/a’;
粘贴l⽂件中内容并编辑新的磁盘组名,在sqlplus中运⾏
SQL>
CREATE CONTROLFILE REUSE DATABASE "prodb" RESETLOGS FORCE LOGGING NOARCHIVELOG MAXLOGFILES 320
MAXLOGMEMBERS 5
MAXDATAFILES 2000
MAXINSTANCES 32
MAXLOGHISTORY 2337
LOGFILE
GROUP 1 '+FQZDATADG/prodb/ONLINELOG/group_1.508.1000913293' SIZE 500M BLOCKSIZE 512, GROUP 2 '+FQZDATADG/prodb/ONLINELOG/group_2.509.1000913293' SIZE 500M BLOCKSIZ
E 512, GROUP 5 '+FQZDATADG/prodb/ONLINELOG/group_5.512.1000913295' SIZE 500M BLOCKSIZE 512, GROUP 6 '+FQZDATADG/prodb/ONLINELOG/group_6.513.1000913295' SIZE 500M BLOCKSIZE 512, GROUP 7 '+FQZDATADG/prodb/ONLINELOG/group_7.514.1000913295' SIZE 500M BLOCKSIZE 512, GROUP 8 '+FQZDATADG/prodb/ONLINELOG/group_8.515.1000913295' SIZE 500M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'+FQZDATADG/PRODBst/datafile/system.350.998332449',
'+FQZDATADG/PRODBst/datafile/sysaux.358.998332809',
'+FQZDATADG/PRODBst/datafile/undotbs1.303.998331203',
'+FQZDATADG/PRODBst/datafile/undotbs2.370.998333315',
'+FQZDATADG/PRODBst/datafile/users.258.998330009',
'+FQZDATADG/PRODBst/datafile/tbs_acctchk.477.998335675',
CHARACTER SET ZHS16GBK
;
SQL>alter database open resetlogs;
[oracle@prodb01a/home/oracle] a
修改cluster_database=true
SQL>create spfile=’+FQZDATADG/a’ from pfile='/home/a';
SQL> shut immediate
ORA-01507: database not mounted
ORACLE instance shut down.
2.2.6 重新注册数据库信息
Oracle⽤户在⼀个节点上执⾏
srvctl add database -d prodb -o /oracle/app/oracle/12.1.0 -p ’+FQZDATADG/a’
srvctl add instance -d prodb -i prodb1 -
srvctl add instance -d prodb -i PRODB -
启动数据库
数据库实例名是什么意思[Oracle@prodbdb01a/home/oracle] srvctl start database -d prodb
⾄此完成prodb数据库迁移切换⼯作
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论