Oracle10gR2 Dataguard: 建立一个ASM实例存储的物理备库

主库: 文件系统存储数据库文件

备库: ASM实例存储数据库文件
建备库方式:
duplicate target database for standby;

1 准备工作

 

1.1 备库Oracle软件安装

参照<<Oracle Database 10gR2 for Linux 安装和维护指南.doc>>, 如果主库是10.2.0.1, 那么备库也安装该版本即可, 无需建库.

.

 

 

1.2 主库Enable force logging

$ sqlplus / as sysdba

SQL> select FORCE_LOGGING from v$database;

FOR

---

NO

SQL> alter database force logging;

SQL> exit;

.

 

 

1.3 备份主库(ASM实例)

1) 全库备份外加备用控制文件

$ rman target /

RMAN> backup as compressed backupset full database include current controlfile for standby format '/u01/backup/bak_full/dbfull_%T_%s_%p.bak' plus archivelog format '/u01/backup/bak_full/archfull_%T_%s_%p.bak';

RMAN> exit;

 

2) 把备份文件拷贝到备库主机

$ scp /u01/backup/bak_full/dbfull* euis2:/u01/backup/bak_full/

$ scp /u01/backup/bak_full/archfull* euis2:/u01/backup/bak_full/

1 建物理备库(ASM实例)

 

1.1 备库准备参数文件

注意路径信息.

$ vi $ORACLE_HOME/dbs/init$ORACLE_SID.ora

#以下为建库必需参数

db_name = EUIS

db_unique_name = EUISASM

db_block_size = 8192

job_queue_processes = 10

sga_max_size = 1G

sga_target = 512M

undo_management = AUTO

undo_tablespace = UNDOTBS1

#以下为一般建库需设置的参数

audit_file_dest = /u01/app/oracle/admin/EUISASM/adump

background_dump_dest = /u01/app/oracle/admin/EUISASM/bdump

core_dump_dest = /u01/app/oracle/admin/EUISASM/cdump

user_dump_dest = /u01/app/oracle/admin/EUISASM/udump

#以下为推荐的参数设置

db_domain = LK

open_cursors = 3000

processes = 500

undo_retention = 86400

db_recovery_file_dest = +DG1

db_recovery_file_dest_size = 2G

#归档主备目录推荐设置

log_archive_dest_1 = 'LOCATION=+DG1/'

log_archive_dest_state_1='ENABLE'

log_archive_format = '%t_%s_%r.arc'

#以下为附加的参数设置

utl_file_dir = '/u01/app/oracle'

#以下为OMF参数设置

db_create_file_dest=+DG1

#以下是作为备库需增加的参数

*.fal_client='db_euisasm'

*.fal_server='db_euis'

*.standby_file_management='AUTO'

#如果要做主备切换需增加的参数设置

compatible='10.2.0'

*.remote_login_passwordfile='EXCLUSIVE'

*.log_archive_config='DG_CONFIG=(EUIS,EUISASM)'

 

参数说明:

db_name='和主库一样';

fal_client/server='tnsnames.ora中配置的网络服务名, 即网络连接串';

standby_file_management='AUTO' 自动同步主库上新建的数据文件到备库, 但主库增删logfile或rename datafile会有限制;

compatible='10.2.0' 备库该参数需大于或等于主库该参数, 最好和主库一样, 如果要做切换, 那主备库的该参数必需一样.

.

 

 

1.2 备库建立密码文件

格式一定是要用orapw<SID>, 密码和主库一样.

$ $ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password='iamENCY000' force=y

.

 

1.3 备库建立需要的目录

--存放trace文件

$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump

mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/bdump

mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/cdump

mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/udump

.

 

 

1.4 主备库建立网络服务名

主库主机和备库主机都建立.

$ vi $ORACLE_HOME/network/admin/tnsnames.ora

db_EUISASM =

   (DESCRIPTION =

     (ADDRESS = (PROTOCOL = TCP)(HOST = euis2)(PORT = 1521))

     (CONNECT_DATA =

       (SERVER = DEDICATED)

       (SERVICE_NAME = EUISASM.LK)

     )

   )

db_euis =

   (DESCRIPTION =

     (ADDRESS_LIST =

       (ADDRESS = (PROTOCOL = TCP)(HOST = euis1)(PORT = 1521))

     )

     (CONNECT_DATA =

       (SERVER = DEDICATED)

       (SERVICE_NAME = EUIS.LK)

     )

   )

.

 

 

1.5 备库建立监听并测试

主机(注意加入ASM实例监听):

$ vi $ORACLE_HOME/network/admin/listener.ora

SID_LIST_LISTENER =

   (SID_LIST =

     (SID_DESC =

       (SID_NAME = EUISASM)

       (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)

       (GLOBAL_DBNAME = EUISASM.LK)

     )

     (SID_DESC =

       (SID_NAME = +ASM)

       (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)

       (GLOBAL_DBNAME = +ASM)

     )

   )

LISTENER =

   (DESCRIPTION_LIST =

     (DESCRIPTION =

       (ADDRESS = (PROTOCOL = TCP)(HOST = euis2)(PORT = 1521))

     )

   )

$ vi $ORACLE_HOME/network/admin/sqlnet.ora

NAMES.DIRECTORY_PATH= (TNSNAMES)

$ lsnrctl start

$ tnsping db_euis

$ tnsping db_euisstd

 

主库主机:

$ tnsping db_euisstd

$ tnsping db_euis

.

--End--

你可能感兴趣的:(oracle10g)