建立Oracle数据库的主备关系,主要是为了实现数据的实时同步和高可用性,在主备关系中,一个数据库作为主库(Primary),负责处理所有的数据更新操作;另一个数据库作为备库(Standby),用于接收主库的数据更新,并保持与主库的数据同步,当主库出现故障时,备库可以快速接管主库的工作,保证业务的连续性。
安庆网站制作公司哪家好,找成都创新互联!从网页设计、网站建设、微信开发、APP开发、响应式网站开发等网站项目制作,到程序开发,运营维护。成都创新互联从2013年创立到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选成都创新互联。
以下是建立Oracle数据库主备关系的详细步骤:
1、配置主库参数文件
需要在主库的参数文件中设置以下参数:
log_archive_dest_state_1=enable
log_archive_dest_1=’location=/u01/app/oracle/oradata/primary/standby’
fal_client=primary
standby_file_management=auto
db_unique_name=’primary’
db_file_name_convert=’/u01/app/oracle/oradata/primary/system.dbf’
db_block_size=8192
db_create_file_dest=’/u01/app/oracle/oradata/primary’
db_recovery_file_dest=’/u01/app/oracle/fast_recovery_area’
db_flashback_online_logs_target=’fal’
db_flashback_recovery_area=’AUTO’
db_flashback_enabled=’TRUE’
db_flashback_on=true
db_flashback_retention_target=0
db_flashback_retention_policy=LOGS
db_flashback_archive_dest=’LOCATION=/u01/app/oracle/fast_recovery_area’
db_create_online_log_dest=’disk’
db_log_archive_config=’DEST_STATE=ENABLE VALID_FOR=(ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME=primary LOG_ARCHIVE_DEST=location="/u01/app/oracle/oradata/primary/standby" ASYNC=false COMPRESSION=none RMAN=ON CONFIGURED_CAPTURE=false’
2、创建归档日志目录
在主库上创建一个目录,用于存储归档日志文件。
mkdir p /u01/app/oracle/oradata/primary/standby chown R oracle:dba /u01/app/oracle/oradata/primary/standby
3、创建备用服务器实例
在备库上创建一个与主库相同的实例,并使用主库的参数文件。
dbca silent responseFile /u01/app/oracle/product/12.1.0/dbhome_1/assistants/dbca/templates/dbca.rsp gdbname primary syspassword Oradoc_db1 systempassword Oradoc_db1 characterset AL32UTF8 sampleschema false createpwd primary storagetype FILE_SYSTEM memory 4G processors 2 instance number 2 nodenumber 1 automatedBackup false destination /u01/app/oracle/oradata/secondary characterset AL32UTF8 globalDBName primary service name primary initPassword Oradoc_db1 force nonContainerized true orclSnapshotDir /u01/app/oracle/fast_recovery_area copyData false crosscheck true spfile /u01/app/oracle/product/12.1.0/dbhome_1/database/spfileprimary.ora controlFile /u01.app.oracle.product.12.1.0.dbhome.1.database.ctlprimary.ora passwordFile /u01.app.oracle.product.12.1.0.dbhome.1.database.pwdprimary.ora startMode auto compatiblediagnosticDestination /u01.app.oracle.product.12.1.0.dbhome.1.rdbms
diag___________________________________________ <``` 4、配置备用服务器实例 在备库实例上执行以下命令,将主库设置为备用服务器的源:
设置备用服务器实例的参数文件路径
ALTER SYSTEM SET db_unique_name=’secondary’ SCOPE=SPFILE;
ALTER SYSTEM SET db_file_name={‘system’,’users’,’example’} SCOPE=SPFILE;
ALTER SYSTEM SET log_archive_dest={‘location=//u01.app.oracle.local/u01.app.oracle.oradata/u01.app.oracle.local/secondary} SCOPE=SPFILE;
ALTER SYSTEM SET fal_client={‘secondary’} SCOPE=SPFILE;
ALTER SYSTEM SET db_block_size=8192 SCOPE=SPFILE;
ALTER SYSTEM SET db_create_file={‘primary’,’secondary’} SCOPE=SPFILE;
ALTER SYSTEM SET db_recovery_file={‘primary’,’secondary’} SCOPE=SPFILE;
ALTER SYSTEM SET db_flashback={‘on’,’off’} SCOPE=SPFILE;
ALTER SYSTEM SET db_flashback={‘logs’,’transactions’,’both’} SCOPE=SPFILE;
ALTER SYSTEM SET db_flashback={‘enable’,’disable’} SCOPE=SPFILE;
ALTER SYSTEM SET db_flashback={‘threshold’,’target’,’policy’,’retention target’,’retention policy’,’archive destination’,’compressed backups’,’valid for all logfiles and roles’,’asynch commit’,’configured capture’,’auto switchover on failover’,’auto switchover on new primary failover’,’auto switchover on local node failure’,’auto switchover on remote node failure’,’auto switchover on connection loss’,’auto switchover on client disconnect’,’auto switchover on session reset’,’auto switchover on transaction rollback’,’auto switchover on transaction commit error’,’auto switchover on transaction prepare error’,’auto switchover on transaction deadlock error’,’auto switchover on transaction serialization error’,’auto switchover on transaction lock time out error’,’auto switchover on transaction system error’,’auto switchover on transaction too long error’,’auto switchover on transaction cancel error’,’auto switchover on transaction update conflict error’,’auto switchover on transaction invalid lock id error’,’auto switchover on transaction deadlock detected error’,’auto switchover on transaction indoubt error’,’auto switchover on transaction distributed deadlock error’,’auto switchover on transaction state change error’,’auto switchover on transaction object lock error’,’auto switchover on transaction object busy error’,’auto switchover on transaction object not found error’,’auto switchover on transaction object no longer valid error’,’auto switchover on transaction object pinned error’,’auto switchover on transaction object purged error’,’auto switchover on transaction object expired error’,’auto switchover on transaction object closed error’,’auto switchover on transaction object locked by another session error’} SCOPE=SPFILE;
ALTER SYSTEM SET db_flashback={‘fast start failover enable’} SCOPE=SPFILE;
ALTER SYSTEM SET db_flashback={‘fast start failover disable’} SCOPE=SPFILE;
ALTER SYSTEM SET db_flashback={‘fast start failover wait for complete recovery before switching over to the new primary’} SCOPE=SPFILE;
ALTER SYSTEM SET db_flashback={‘fast start failover wait for apply redo to complete before switching over to the new primary’} SCOPE=SPFILE;
ALTER SYSTEM SET db_flashback={‘fast start failover wait for archived redo logs to be applied before switching over to the new primary’} SCOPE=SPFILE;
ALTER SYSTEM SET db_flashback={‘fast start failover wait for log apply to complete before switching over to the new primary’} SCOPE=SPFILE;
ALTER SYSTEM SET db
网站名称:建立Oracle数据库的主备关系
文章源于:http://www.shufengxianlan.com/qtweb/news49/108999.html
网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联