1、在vmware下配置ORACLE的RAC+DG精品文档在vmware下配置ORACLE的RAC+DG我用虚拟机装了rac+ a Single Instance Physical Standby已经配置成功了。并能进行自动的切换.我在这里就先贴一个,其实这个帖子我在这个联接很久就发布.但是还有好多朋友没有发现( . p;extra=&page=6)一、系统的准备工作1对系统IP地址的规划oraclerac2 dbs$ cat /etc/hosts# Do not remove the following line, or various programs# that require networ
2、k functionality will fail.127.0.0.1 localhosts192.168.20.152rac2 -RAC2主库192.168.20.151rac1 -RAC1主库10.10.10.2 rac2-priv10.10.10.1 rac1-priv192.168.20.139pri-rac -DATAGUARD的备用库2安装配置好ORACLE9I RAC的数据库和数据库软件能正常的启动和关闭数据库 INST_ID INSTANCE_NUMBER INSTANCE_NAME HOST_NAME STATUS- - - - - 2 2 devdb2 rac2 OPEN
3、1 1 devdb1 rac1 OPENSQL l1* select inst_id,instance_number,instance_name,host_name,status from gv$instanceSQL /COMP_IDCOMP_NAME VERSION STATUS- - - -CATALOGOracle9i Catalog Views 9.2.0.4.0VALIDCATPROCOracle9i Packages and Types 9.2.0.4.0VALIDOWM Oracle Workspace Manager 9.2.0.1.0VALIDJAVAVM JServer
4、JAVA Virtual Machine 9.2.0.4.0VALIDXML Oracle XDK for Java 9.2.0.6.0VALIDCATJAVAOracle9i Java Packages 9.2.0.4.0VALIDORDIM Oracle interMedia 9.2.0.4.0VALIDSDO Spatial 9.2.0.4.0LOADEDCONTEXTOracle Text 9.2.0.4.0VALIDXDB Oracle XML Database 9.2.0.4.0VALIDWK Oracle Ultra Search 9.2.0.4.0VALIDCOMP_IDCOM
5、P_NAME VERSION STATUS- - - -ODM Oracle Data Mining 9.2.0.1.0LOADEDAPS OLAP Analytic Workspace 9.2.0.4.0LOADEDXOQ Oracle OLAP API 9.2.0.4.0LOADEDAMD OLAP Catalog 9.2.0.4.0VALIDRAC Oracle9i Real Application Clusters9.2.0.4.0VALID16 rows selected.SQL l1* select comp_id,comp_name,version,status from dba
6、_registry3安装配置好备用库上的数据库软件和配置好数据库的环境变量这些文件RAC1和RAC2上的环境变量oraclerac2 dbs$ cat /home/oracle/.bash_profile# .bash_profile# Get the aliases and functionsif -f /.bashrc ; then . /.bashrcfi# User specific environment and startup programsPATH=$PATH:$HOME/binexport PATHPATH=$PATH:$HOME/bin #ORACLE_BASE 可以定位到
7、盘阵上/data export ORACLE_BASE=/home/oracle/product export ORACLE_HOME=/home/oracle/product/9.2.0.4 export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin export ORACLE_OWNER=oracle export ORACLE_SID=devdb2 export ORACLE_TERM=xterm export LD_ASSUME_KERNEL=2.4.19 export THREADS_FLAG=native ex
8、port LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib export NLS_LANG=American_america.zhs16gbk # export NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data #export DISPLAY=:0 #export LANG=en_US #export GDM_LANG= en_US #export LC= en_US #export PATH expor
9、t DBCA_RAW_CONFIG=/home/oracle/DBCA_RAW_CONFIG.txtunset USERNAMEPRI-RAC备用库的环境变量oraclepri-rac devdb$ cat /home/oracle/.bash_profile# .bash_profile# Get the aliases and functionsif -f /.bashrc ; then . /.bashrcfi# User specific environment and startup programsPATH=$PATH:$HOME/binexport PATHPATH=$PATH:
10、$HOME/bin #ORACLE_BASE 可以定位到盘阵上/data export ORACLE_BASE=/home/oracle/product export ORACLE_HOME=/home/oracle/product/9.2.0.4 export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin export ORACLE_OWNER=oracle export ORACLE_SID=devdb export ORACLE_TERM=xterm export LD_ASSUME_KERNEL=2.4.19 ex
11、port THREADS_FLAG=native export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib export NLS_LANG=American_america.zhs16gbk # export NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data #export DISPLAY=:0 #export LANG=en_US #export GDM_LANG= en_US #export L
12、C= en_US #export PATH export DBCA_RAW_CONFIG=/home/oracle/DBCA_RAW_CONFIG.txtunset USERNAME4安装配置RAC1,RAC2,PRI-RAC主机网络listener.ora文件和tnsnames.ora文件在RAC1和RAC2上的listener.ora和tnsnames.ora文件这个是RAC2的listener.ora文件内容oraclerac2 admin$ cat listener.ora# LISTENER.ORA.RAC2 Network Configuration File: /home/ora
13、cle/product/9.2.0.4/network/admin/listener.ora.rac2# Generated by Oracle configuration tools.LISTENER =(DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac2)(PORT = 1521) ) )SID_LIST_LISTENER =(SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /home/o
14、racle/product/9.2.0.4) (PROGRAM = extproc) ) (SID_DESC = (ORACLE_HOME = /home/oracle/product/9.2.0.4) (SID_NAME = devdb2) )这个是RAC1上的listener.ora文件内容oraclerac1 admin$ cat listener.ora # LISTENER.ORA.RAC1 Network Configuration File: /home/oracle/product/9.2.0.4/network/admin/listener.ora.rac1# Generat
15、ed by Oracle configuration tools.LISTENER =(DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521) ) )SID_LIST_LISTENER =(SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /home/oracle/product/9.2.0.4) (PROGRAM = extproc) ) (SID_DESC = (OR
16、ACLE_HOME = /home/oracle/product/9.2.0.4) (SID_NAME = devdb1) )这个是RAC2的 tnsnames.ora文件内容oraclerac2 admin$ cat tnsnames.ora# TNSNAMES.ORA Network Configuration File: /home/oracle/product/9.2.0.4/network/admin/tnsnames.ora# Generated by Oracle configuration tools.LISTENER_DEVDB1 =(ADDRESS = (PROTOCOL
17、= TCP)(HOST = rac1)(PORT = 1521)INST1_HTTP =(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521) ) (CONNECT_DATA = (SERVER = SHARED) (SERVICE_NAME = MODOSE) (PRESENTATION = http:/HRService) )DEVDB2 =(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac2)(PORT = 1521)
18、(CONNECT_DATA = (SERVICE_NAME = devdb) (INSTANCE_NAME = devdb2) )DEVDB1 =(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521) (CONNECT_DATA = (SERVICE_NAME = devdb) (INSTANCE_NAME = devdb1) )DEVDB =(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521) (
19、ADDRESS = (PROTOCOL = TCP)(HOST = rac2)(PORT = 1521) (LOAD_BALANCE = yes) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = devdb) )LISTENERS_DEVDB =(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521) (ADDRESS = (PROTOCOL = TCP)(HOST = rac2)(PORT = 1521)LISTENER_DEVDB2 =(ADDRE
20、SS = (PROTOCOL = TCP)(HOST = rac2)(PORT = 1521)STANDBY =(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.139)(PORT = 1521) ) (CONNECT_DATA = (SERVICE_NAME = devdb) )这个两个TNS是我们主要使用的DEVDB是做为主库的。Standby是作为备用库的TNS这个是RAC1上的TNSNAMES.ORA文件的内容oraclerac1 admin$ cat tnsnames.ora# T
21、NSNAMES.ORA Network Configuration File: /home/oracle/product/9.2.0.4/network/admin/tnsnames.ora# Generated by Oracle configuration tools.LISTENER_DEVDB1 =(ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521)INST1_HTTP =(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 15
22、21) ) (CONNECT_DATA = (SERVER = SHARED) (SERVICE_NAME = MODOSE) (PRESENTATION = http:/HRService) )DEVDB2 =(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac2)(PORT = 1521) ) (CONNECT_DATA = (SERVICE_NAME = devdb) (INSTANCE_NAME = devdb2) )DEVDB1 =(DESCRIPTION = (ADDRESS_LIST = (AD
23、DRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521) ) (CONNECT_DATA = (SERVICE_NAME = devdb) (INSTANCE_NAME = devdb1) )STANDBY =(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.139)(PORT = 1521) ) (CONNECT_DATA = (SERVICE_NAME = devdb) )DEVDB =(DESCRIPTION = (ADDRESS_LIST
24、= (ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521) (ADDRESS = (PROTOCOL = TCP)(HOST = rac2)(PORT = 1521) (LOAD_BALANCE = yes) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = devdb) )LISTENERS_DEVDB =(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521) (ADDRESS = (PROTOCO
25、L = TCP)(HOST = rac2)(PORT = 1521)LISTENER_DEVDB2 =(ADDRESS = (PROTOCOL = TCP)(HOST = rac2)(PORT = 1521)以上在配置好要进行相应的测试,也测试能否连同各个数据库这个pri-rac备用库的listener.ora和tnsnames.ora文件内容oraclepri-rac admin$ cat listener.ora# LISTENER.ORA Network Configuration File: /home/oracle/product/9.2.0.4/network/admin/list
26、ener.ora# Generated by Oracle configuration tools.LISTENER =(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.139)(PORT = 1521)SID_LIST_LISTENER =(SID_LIST = (SID_DESC = (GLOBAL_DBNAME = devdb) (ORACLE_HOME = /home/oracle/product/9.2.0.4) (SID_NAME = devdb) )以下是tnsname.ora文件内容oraclepri-ra
27、c admin$ cat tnsnames.ora# TNSNAMES.ORA Network Configuration File: /home/oracle/product/9.2.0.4/network/admin/tnsnames.ora# Generated by Oracle configuration tools.INST1_HTTP =(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.139)(PORT = 1521) ) (CONNECT_DATA = (SERVER =
28、SHARED) (SERVICE_NAME = MODOSE) (PRESENTATION = http:/HRService) )STANDBY =(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.139)(PORT = 1521) ) (CONNECT_DATA = (SERVICE_NAME = devdb) )DEVDB =(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.151)
29、(PORT = 1521) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.152)(PORT = 1521) (LOAD_BALANCE = yes) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = devdb) )以上在配置好要进行相应的测试,也测试能否连同各个数据库5安装和配置pri-rac上的参数文件initdevdb.ora文件安装和配置pri-rac上的参数文件initdevdb.ora文件,并配置好相应的密码文件和dataguard的相关参数。其实initdevdb.ora文
30、件可以从RAC1或者RAC2的机器上COPY过来,然后再把带有RAC的项目去掉$sqlpluc /nologSQLconn / as sysdbaSQLcreate pfile from spfile;scp $ORACLE_HOME/dbs/initdevdb1.ora pri-ra:$ORACLE_HOME/dbs再修改相应的的参数,以下是pri-rac上的initdevdb.ora文件内容:oraclepri-rac dbs$ cat initdevdb.ora*.aq_tm_processes=1*.background_dump_dest=/home/oracle/product/a
31、dmin/devdb/bdump*.compatible=9.2.0.0.0*.control_files=/home/oracle/product/oradata/devdb/control01.ctl,/home/oracle/product/oradata/devdb/control02.ctl,/home/oracle/product/oradata/devdb/control03.ctl*.core_dump_dest=/home/oracle/product/admin/devdb/cdump*.db_block_size=8192*.db_cache_size=33554432*
32、.db_domain=*.db_file_multiblock_read_count=16*.db_name=devdb*.dispatchers=(PROTOCOL=TCP) (SERVICE=devdbXDB)*.fast_start_mttr_target=300*.hash_join_enabled=TRUE*.instance_name=devdb*.java_pool_size=20971520*.job_queue_processes=10*.large_pool_size=33554432*.open_cursors=300*.pga_aggregate_target=2516
33、5824*.processes=150*.query_rewrite_enabled=FALSE*.remote_login_passwordfile=EXCLUSIVE*.shared_pool_size=33554432*.sort_area_size=524288*.star_transformation_enabled=FALSE*.timed_statistics=TRUE*.undo_management=AUTO*.undo_retention=10800*.undo_tablespace=UNDOTBS1*.user_dump_dest=/home/oracle/product
34、/admin/devdb/udump# DATA GURAD备用库的参数配置#*.aq_tm_processes=1#*.compatible=9.2.0.0.0*.log_archive_start=true*.log_archive_dest_1=LOCATION=/home/oracle/archive/primary-本地归档的归档日志位置*.log_archive_dest_2=service=devdb mandatory reopen=60 -传输到备用库上的归档日志位置*.log_archive_format=%t_%s.dbf*.db_file_name_convert=/h
35、ome/oracle/product/oradata/devdb/,/home/oracle/product/oradata/devdb/*.log_file_name_convert=/home/oracle/product/oradata/devdb/,/home/oracle/product/oradata/devdb/*.utl_file_dir=/home/oracle*.standby_archive_dest=/home/oracle/archive/primary -备用库上的归档日志目录*.standby_file_management=AUTO*.fal_server=de
36、vdb*.fal_client=standby在这里一定要注意db_file_name_convert,log_file_name_convert参数的值配置,在RMAN恢复他的时候,要采用,如且一定要保证配置的正确。同时也要创建好相应的目录$ORACLE_BASE/admin/devdb/bdump cdump这些相应的目录,如果感觉难创建可以直接从RAC1或者RAC2上COPY过来,然后修改下alter_devdb.log文件,就OK了。6配置NFS在PRI-RAC上配置修改pri-rac备库机器上的/etc/exports文件oraclepri-rac dbs$ cat /etc/exp
37、orts/home/oracle/product/backup *(async,rw)添加此行。启动portmap service portmap start启动NFS service NFS startrootpri-rac # service nfs restart关闭 NFS mountd:失败关闭 NFS 守护进程:失败关闭 NFS quotas:失败关闭 NFS 服务: 失败启动 NFS 服务: 确定关掉 NFS 配额:确定启动 NFS 守护进程:确定启动 NFS mountd:确定在RAC1和RAC2的机器上分别挂载上此目录rootrac2 bin# mount -t nfs -o
38、 rw,noac,hard,timeo=600,wsize=32768,rsize=32768,vers=3,proto=tcp192.168.20.139:/home/oracle/product/backup /home/oracle/product/backuprootrac2 bin# df -hFilesystem 容量已用 可用 已用% 挂载点/dev/sda1 13G5.5G6.7G45% /none 345M 0345M 0% /dev/shm192.168.20.139:/home/oracle/product/backup 13G7.5G4.8G61% /home/orac
39、le/product/backup上面此目录要在RAC1和RAC2上分别挂载上。到此准备工作已经完成。下面要开始备份RAC库,以及他的控制文件和日志文件二、为physical standby库备份RAC数据库在做好以上这些准备后,我们就可以开始备份RAC数据库了。全库备份RAC数据库以及控制文件run allocate channel c1 device type disk format /home/oracle/product/backup/full_%U_%I.dbf connect sys/stu01devdb1;allocate channel c2 device type disk
40、format /home/oracle/product/backup/full_%U_%I.dbf connect sys/stu01devdb2;backup database plus archivelog delete all input;backup current controlfile for standby;release channel c1;RMAN run 2 allocate channel c1 device type disk format /home/oracle/product/backup/full_%U_%I.dbf connectsys/stu01devdb
41、1;3 allocate channel c2 device type disk format /home/oracle/product/backup/full_%U_%I.dbf connectsys/stu01devdb2;4 backup database ;5 release channel c1;6 release channel c2;7 allocated channel: c1channel c1: sid=24 devtype=DISKallocated channel: c2channel c2: sid=19 devtype=DISKStarting backup at 23-OCT-09channel c1: starting full datafile backupsetchannel c1: specifying datafile(s) in backupsetchannel c2: starting full datafile backupsetchannel c2: specifying datafile(s) in backupsetinput datafile fno=00002 name=/home/oracle/product/oradata/devdb/undotbs01.dbfinput datafile fno=00011 name=
©2010-2024 宁波自信网络信息技术有限公司 版权所有
客服电话:4008-655-100 投诉/维权电话:4009-655-100