当生产端应用为Oracle RAC集群,灾备端为单机时,在灾备端创建完数据库后,需要执行相关配置操作。
单实例环境下且数据库是安装在文件系统上时的灾备端数据库环境,需要将生产端的数据库所必须的文件和文件夹拷贝到灾备端,并修改拷贝文件所属的用户和组。包括拷贝以下目录和文件:$ORACLE_BASE\admin\dbname下所有目录;$ORACLE_HOME\network\admin\listener.ora文件;$ORACLE_HOME\network\admin\tnsnames.ora;$ORACLE_HOME\dbs下的密码文件和参数文件到灾备端的相同目录。
oracle@suse140:/u01/app/oracle/product/11.2.0/db_1/dbs> export ORACLE_SID=lqraw1 oracle@suse140:/u01/app/oracle/product/11.2.0/db_1/dbs> sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Fri Jun 26 09:57:08 2020 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +LQRAWDATA/lqraw/spfilelqraw.o
ra
SQL> create pfile='/home/oracle/initlqraw1.ora' from spfile; File created.


红色字体部分为修改的内容,具体的修改方法请咨询数据库管理员,以防止修改后对灾备数据库产生影响。
oracle@suse140:/u01/app/oracle/product/11.2.0/db_1/dbs> export ORACLE_SID=lqraw
oracle@suse140:/u01/app/oracle/product/11.2.0/db_1/dbs> sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jun 26 09:57:08 2020
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> startup pfile='/home/oracle/ initlqraw1.ora'; ORACLE instance started. Total System Global Area 5144301568 bytes Fixed Size 2230424 bytes Variable Size 1157629800 bytes Database Buffers 3976200192 bytes Redo Buffers 8241152 bytes Database mounted. Database opened.
SQL> create spfile from pfile='/home/oracle/initlqraw1.ora';
File created.
SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down.
SQL> startup ORACLE instance started. Total System Global Area 5144301568 bytes Fixed Size 2230424 bytes Variable Size 1157629800 bytes Database Buffers 3976200192 bytes Redo Buffers 8241152 bytes Database mounted. Database opened.
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/11.2.0/product
/db/dbs/spfilelqraw.ora
对于Oracle 12c数据库,以上操作完成后,请执行srvctl modify database -db 数据库名称 -spfile spfile文件本地路径命令,将spfile文件指定到本地路径。
非Windows操作系统下的dbca、Windows操作系统下Database Configuration Assistant。
创建数据库后的spfile文件的存放在本地或LUN上。
检查非Windows操作系统下“$ORACLE_HOME/dbs”,Windows操作系统下“%ORACLE_HOME%/database”目录中是否存在“spfile${ORACLE_SID}.ora”和“init${ORACLE_SID}.ora”文件。
bash-4.2$ cat initautoasm.ora SPFILE='+PG_AUTOASM$_DATA/autoasm/spfileautoasm.ora' bash-4.2$ export ORACLE_SID=autoasm
bash-4.2$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu Jun 26 09:32:39 2020
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> create pfile='/home/oracle/initautoasm.ora' from spfile; File created.
SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down.
SQL> startup pfile='/home/oracle/initautoasm.ora'; ORACLE instance started. Total System Global Area 5144301568 bytes Fixed Size 2230424 bytes Variable Size 1157629800 bytes Database Buffers 3976200192 bytes Redo Buffers 8241152 bytes Database mounted. Database opened.
SQL> create spfile from pfile='/home/oracle/initautoasm.ora'; File created.
SQL> startupORACLE instance started. Total System Global Area 5144301568 bytes Fixed Size 2230424 bytes Variable Size 1157629800 bytes Database Buffers 3976200192 bytes Redo Buffers 8241152 bytes Database mounted. Database opened.
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/11.2.0/product
/db/dbs/spfileautoasm.ora
对于Oracle 12c数据库,以上操作完成后,请执行srvctl modify database -db 数据库名称 -spfile spfile文件本地路径命令,将spfile文件指定到本地路径。