使用ansible-playbook自动化安装Oracle DG数据库19c

【用剧本安装Oracle DG数据库】

源库是RAC,安装的话可以参考之前内容,目标库DG是单机文件系统

说明:源库是RAC架构,DG是单机文件系统架构,管理使用dgbroker管理(这里使用命令行操作),安装单机数据库然后使用createDuplicateDB方式创建DG库,由于剧本脚本较多,可以留言发送脚本

所有剧本目录信息

tree  oracle_dg/
oracle_dg/
├── files 一些安装包
│   ├── compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
│   ├── expect-5.45-14.el7_1.x86_64.rpm
│   ├── oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
│   ├── pdksh-5.2.14-37.el5.x86_64.rpm
│   ├── tcl-8.5.13-8.el7.i686.rpm
│   └── tcl-8.5.13-8.el7.x86_64.rpm
├── tasks 剧本任务
│   ├── 01_change_os_setting_19cR3.yml
│   ├── 02_change_oracle_params_19cR3.yml
│   ├── 03_add_oracle_group_user_19cR3.yml
│   ├── 04_install_oracle_database_soft_19cR3.yml
│   ├── 05_run_oracle_rootsh_dg_node_19cR3.yml
│   ├── 06_run_oracle_listener_rac_and_dg_node_19cR3.yml
│   ├── 07_run_oracle_tnsnames_rac_and_dg_node_19cR3.yml
│   ├── 08_run_force_logging_standby_logfile_primary_node_19cR3.yml
│   ├── 09_run_dg_createduplicatedb_dg_node_19cR3.yml
│   ├── 10_seting_dgparameter_primary_dg_node_19cR3.yml
│   ├── 11_using_current_logfile_dg_node_19cR3.yml
│   ├── init_cluster.yml
│   ├── main_mauel.yml
│   ├── main.yml
│   ├── prepare.yml
│   └── split.yml
├── templates 一些脚本
│   ├── add_standbylogfile.sql
│   ├── auto_grid_ssh02.sh
│   ├── auto_grid_ssh.sh
│   ├── auto_oracle_ssh02.sh
│   ├── auto_oracle_ssh.sh
│   ├── check_force_logging.sql
│   ├── check_standbylogfile.sql
│   ├── db.rsp
│   ├── dg_node_dgparameter_setting.sql
│   ├── dg_using_current_logfile.sql
│   ├── grid.rsp
│   ├── netca.rsp
│   ├── open_force_logging.sql
│   ├── primary_node_dgparameter_setting.sql
│   ├── sshUserSetup.sh
│   └── tnsnames.ora
└── vars 变量
    ├── main.yml
    └── main.yml_bak(这个是不使用dbbroker方式管理DG,不建议)

设置ansible hosts

[oracle_dg]
10.0.0.xx ansible_user=root ansible_ssh_pass=Lh22m2aJ6313 cluster_role=dg
10.0.0.xxx ansible_user=root ansible_ssh_pass=Lh22m2aJ6313 cluster_role=node1
10.0.0.xxx ansible_user=root ansible_ssh_pass=Lh22m2aJ6313 cluster_role=node2

设置剧本的环境变量

---

# OS
soft_dir: /home/soft       数据库介质目录
oracle_passwd: oracle      Oracle账号密码
oracle_base_dir: /u01/app  数据库软件目录

# DB
oracle_sid: orcl           数据库sid
characterset: ZHS16GBK     数据库字符集
oracle_release_update: 34419443 数据库RU版本
primary_standby_logfile: 120    standlog文件大小M单位
data_dir: /home/oracle/oradata  数据库数据目录
archived_dir: /home/oracle/archivelog  数据库归档目录

 

最后安装日志信息,以下屏蔽掉了IP信息

ansible-playbook oracle_dg.yaml 

PLAY [oracle_dg] ************************************************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************************************************
ok: [10.0.0.xx]
ok: [10.0.0.xxx]
ok: [10.0.0.xxx]

TASK [oracle_dg : set hostname on dgnode] ***********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : create soft directory on dg node] *************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : copy expect tcl  rpm package on all node] *****************************************************************************************************************************
skipping: [10.0.0.xxx] => (item=expect-5.45-14.el7_1.x86_64.rpm) 
skipping: [10.0.0.xxx] => (item=tcl-8.5.13-8.el7.x86_64.rpm) 
skipping: [10.0.0.xxx] => (item=expect-5.45-14.el7_1.x86_64.rpm) 
skipping: [10.0.0.xxx] => (item=pdksh-5.2.14-37.el5.x86_64.rpm) 
skipping: [10.0.0.xxx] => (item=tcl-8.5.13-8.el7.x86_64.rpm) 
skipping: [10.0.0.xxx] => (item=compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm) 
skipping: [10.0.0.xxx] => (item=pdksh-5.2.14-37.el5.x86_64.rpm) 
skipping: [10.0.0.xxx] => (item=oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm) 
skipping: [10.0.0.xxx] => (item=compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm) 
skipping: [10.0.0.xxx] => (item=oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm) 
ok: [10.0.0.xx] => (item=expect-5.45-14.el7_1.x86_64.rpm)
ok: [10.0.0.xx] => (item=tcl-8.5.13-8.el7.x86_64.rpm)
ok: [10.0.0.xx] => (item=pdksh-5.2.14-37.el5.x86_64.rpm)
ok: [10.0.0.xx] => (item=compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm)
ok: [10.0.0.xx] => (item=oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm)

TASK [oracle_dg : install expect tcl  rpm on all node] **********************************************************************************************************************************
skipping: [10.0.0.xxx] => (item=[]) 
skipping: [10.0.0.xxx] => (item=[]) 
ok: [10.0.0.xx] => (item=[u'/home/soft/tcl-8.5.13-8.el7.x86_64.rpm', u'/home/soft/expect-5.45-14.el7_1.x86_64.rpm'])

TASK [oracle_dg] ************************************************************************************************************************************************************************
ok: [10.0.0.xx]
ok: [10.0.0.xxx]
ok: [10.0.0.xxx]

TASK [oracle_dg : declare dg host group] ************************************************************************************************************************************************
ok: [10.0.0.xx] => (item=10.0.0.xx)
ok: [10.0.0.xx] => (item=10.0.0.xxx)
ok: [10.0.0.xx] => (item=10.0.0.xxx)
ok: [10.0.0.xxx] => (item=10.0.0.xx)
ok: [10.0.0.xxx] => (item=10.0.0.xxx)
ok: [10.0.0.xxx] => (item=10.0.0.xxx)
ok: [10.0.0.xxx] => (item=10.0.0.xx)
ok: [10.0.0.xxx] => (item=10.0.0.xxx)
ok: [10.0.0.xxx] => (item=10.0.0.xxx)

TASK [oracle_dg : change SELinux is disable] ********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : stop firewall] ********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : stop auto start a firewall] *******************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : install oracle-database-preinstall   rpm] *****************************************************************************************************************************
skipping: [10.0.0.xxx] => (item=oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm) 
skipping: [10.0.0.xxx] => (item=oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm) 
ok: [10.0.0.xx] => (item=oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm)

TASK [oracle_dg : stop auto start a avahi-daemon] ***************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : stop avahi-daemon] ****************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : stop auto start a chronyd] ********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : stop chronyd] *********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : backup for /etc/hosts] ************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : create file for oracle.hosts] *****************************************************************************************************************************************
skipping: [10.0.0.xxx] => (item=###FOR DG BEGIN) 
skipping: [10.0.0.xxx] => (item=###Source Public IP) 
skipping: [10.0.0.xxx] => (item=10.0.0.xxx     rac01) 
skipping: [10.0.0.xxx] => (item=10.0.0.xxx     rac02) 
skipping: [10.0.0.xxx] => (item= ) 
skipping: [10.0.0.xxx] => (item=###Source Scan IP) 
skipping: [10.0.0.xxx] => (item=###FOR DG BEGIN) 
skipping: [10.0.0.xxx] => (item=10.0.0.189     rac-scan) 
skipping: [10.0.0.xxx] => (item=###Source Public IP) 
skipping: [10.0.0.xxx] => (item= ) 
skipping: [10.0.0.xxx] => (item=10.0.0.xxx     rac01) 
skipping: [10.0.0.xxx] => (item=###DG Public IP) 
skipping: [10.0.0.xxx] => (item=10.0.0.xxx     rac02) 
skipping: [10.0.0.xxx] => (item=10.0.0.xx      dbca_stby) 
skipping: [10.0.0.xxx] => (item= ) 
skipping: [10.0.0.xxx] => (item=###FOR DG END) 
skipping: [10.0.0.xxx] => (item=###Source Scan IP) 
skipping: [10.0.0.xxx] => (item=10.0.0.189     rac-scan) 
skipping: [10.0.0.xxx] => (item= ) 
skipping: [10.0.0.xxx] => (item=###DG Public IP) 
skipping: [10.0.0.xxx] => (item=10.0.0.xx      dbca_stby) 
skipping: [10.0.0.xxx] => (item=###FOR DG END) 
ok: [10.0.0.xx] => (item=###FOR DG BEGIN)
ok: [10.0.0.xx] => (item=###Source Public IP)
ok: [10.0.0.xx] => (item=10.0.0.xxx     rac01)
ok: [10.0.0.xx] => (item=10.0.0.xxx     rac02)
ok: [10.0.0.xx] => (item= )
ok: [10.0.0.xx] => (item=###Source Scan IP)
ok: [10.0.0.xx] => (item=10.0.0.189     rac-scan)
ok: [10.0.0.xx] => (item= )
ok: [10.0.0.xx] => (item=###DG Public IP)
ok: [10.0.0.xx] => (item=10.0.0.xx      dbca_stby)
ok: [10.0.0.xx] => (item=###FOR DG END)

TASK [oracle_dg : create file for rac oracle.hosts] *************************************************************************************************************************************
skipping: [10.0.0.xx] => (item=###FOR DG BEGIN) 
skipping: [10.0.0.xx] => (item=###DG Public IP) 
skipping: [10.0.0.xx] => (item=10.0.0.xx      dbca_stby) 
skipping: [10.0.0.xx] => (item=###FOR DG END) 
ok: [10.0.0.xxx] => (item=###FOR DG BEGIN)
ok: [10.0.0.xxx] => (item=###FOR DG BEGIN)
ok: [10.0.0.xxx] => (item=###DG Public IP)
ok: [10.0.0.xxx] => (item=###DG Public IP)
ok: [10.0.0.xxx] => (item=10.0.0.xx      dbca_stby)
ok: [10.0.0.xxx] => (item=10.0.0.xx      dbca_stby)
ok: [10.0.0.xxx] => (item=###FOR DG END)
ok: [10.0.0.xxx] => (item=###FOR DG END)

TASK [oracle_dg : backup for grub.cfg] **************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : change for grub.cfg] **************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
[WARNING]: Consider using the replace, lineinfile or template module rather than running 'sed'.  If you need to use command because replace, lineinfile or template is insufficient you
can add 'warn: false' to this command task or set 'command_warnings=False' in ansible.cfg to get rid of this message.
changed: [10.0.0.xx]

TASK [oracle_dg : make grub2] ***********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : backup for /etc/sysctl.conf] ******************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : sysctl] ***************************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
[WARNING]: The value 2 (type int) in a string field was converted to u'2' (type string). If this does not look like what you expect, quote the entire value to ensure it does not
change.
ok: [10.0.0.xx]

TASK [oracle_dg : sysctl] ***************************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : sysctl] ***************************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
[WARNING]: The value 6815744 (type int) in a string field was converted to u'6815744' (type string). If this does not look like what you expect, quote the entire value to ensure it
does not change.
ok: [10.0.0.xx]

TASK [oracle_dg : stat /etc/ntp.conf] ***************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : move file /etc/ntp.conf] **********************************************************************************************************************************************
skipping: [10.0.0.xx]
fatal: [10.0.0.xxx]: FAILED! => {"msg": "The conditional check '( result.stat.exists ) and ( cluster_role == \"dg\" )' failed. The error was: error while evaluating conditional (( result.stat.exists ) and ( cluster_role == \"dg\" )): 'dict object' has no attribute 'stat'\n\nThe error appears to be in '/root/auto/ansible_dg/roles/oracle_dg/tasks/02_change_oracle_params_19cR3.yml': line 76, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: move file /etc/ntp.conf\n      ^ here\n"}
...ignoring
fatal: [10.0.0.xxx]: FAILED! => {"msg": "The conditional check '( result.stat.exists ) and ( cluster_role == \"dg\" )' failed. The error was: error while evaluating conditional (( result.stat.exists ) and ( cluster_role == \"dg\" )): 'dict object' has no attribute 'stat'\n\nThe error appears to be in '/root/auto/ansible_dg/roles/oracle_dg/tasks/02_change_oracle_params_19cR3.yml': line 76, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: move file /etc/ntp.conf\n      ^ here\n"}
...ignoring

TASK [oracle_dg : stat /var/run/ ntpid.pid] *********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : remove file /var/run/ntpd.pid] ****************************************************************************************************************************************
skipping: [10.0.0.xx]
fatal: [10.0.0.xxx]: FAILED! => {"msg": "The conditional check '( result.stat.exists ) and ( cluster_role == \"dg\" )' failed. The error was: error while evaluating conditional (( result.stat.exists ) and ( cluster_role == \"dg\" )): 'dict object' has no attribute 'stat'\n\nThe error appears to be in '/root/auto/ansible_dg/roles/oracle_dg/tasks/02_change_oracle_params_19cR3.yml': line 86, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: remove file /var/run/ntpd.pid\n      ^ here\n"}
...ignoring
fatal: [10.0.0.xxx]: FAILED! => {"msg": "The conditional check '( result.stat.exists ) and ( cluster_role == \"dg\" )' failed. The error was: error while evaluating conditional (( result.stat.exists ) and ( cluster_role == \"dg\" )): 'dict object' has no attribute 'stat'\n\nThe error appears to be in '/root/auto/ansible_dg/roles/oracle_dg/tasks/02_change_oracle_params_19cR3.yml': line 86, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: remove file /var/run/ntpd.pid\n      ^ here\n"}
...ignoring

TASK [oracle_dg : pam_limits] ***********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
[WARNING]: The value 2047 (type int) in a string field was converted to u'2047' (type string). If this does not look like what you expect, quote the entire value to ensure it does not
change.
ok: [10.0.0.xx]

TASK [oracle_dg : pam_limits] ***********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
[WARNING]: The value 16384 (type int) in a string field was converted to u'16384' (type string). If this does not look like what you expect, quote the entire value to ensure it does
not change.
ok: [10.0.0.xx]

TASK [oracle_dg : pam_limits] ***********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
[WARNING]: The value 1024 (type int) in a string field was converted to u'1024' (type string). If this does not look like what you expect, quote the entire value to ensure it does not
change.
ok: [10.0.0.xx]

TASK [oracle_dg : pam_limits] ***********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
[WARNING]: The value 65536 (type int) in a string field was converted to u'65536' (type string). If this does not look like what you expect, quote the entire value to ensure it does
not change.
ok: [10.0.0.xx]

TASK [oracle_dg : pam_limits] ***********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
[WARNING]: The value 10240 (type int) in a string field was converted to u'10240' (type string). If this does not look like what you expect, quote the entire value to ensure it does
not change.
ok: [10.0.0.xx]

TASK [oracle_dg : pam_limits] ***********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : pam_limits] ***********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : pam_limits] ***********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : pam_limits] ***********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : pam_limits] ***********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : pam_limits] ***********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : pam_limits] ***********************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : check group for oinstall] *********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : add group for oinstall] ***********************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : check group for dba] **************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : add group for dba] ****************************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : check group for oper] *************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : add group for oper] ***************************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : check group for backupdba] ********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : add group for backupdba] **********************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : check group for dgdba] ************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : add group for dgdba] **************************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : check group for kmdba] ************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : add group for kmdba] **************************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : check group for asmadmin] *********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : add group for asmadmin] ***********************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : check group for asmdba] ***********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : add group for asmdba] *************************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : check group for asmoper] **********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : add group for asmoper] ************************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : check group for racdba] ***********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : add group for racdba] *************************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : check user for grid] **************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : add user for grid] ****************************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : check user for oracle] ************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : add user for oracle] **************************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : change password for grid] *********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : change password for oracle] *******************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : create directory for grid base] ***************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
[WARNING]: Consider using the file module with state=directory rather than running 'mkdir'.  If you need to use command because file is insufficient you can add 'warn: false' to this
command task or set 'command_warnings=False' in ansible.cfg to get rid of this message.
changed: [10.0.0.xx]

TASK [oracle_dg : create directory for oracle base] *************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : create directory for grid home] ***************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : change owner for grid] ************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
[WARNING]: Consider using the file module with owner rather than running 'chown'.  If you need to use command because file is insufficient you can add 'warn: false' to this command
task or set 'command_warnings=False' in ansible.cfg to get rid of this message.
changed: [10.0.0.xx]

TASK [oracle_dg : change owner for oracle] **********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : change] ***************************************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
[WARNING]: Consider using the file module with mode rather than running 'chmod'.  If you need to use command because file is insufficient you can add 'warn: false' to this command task
or set 'command_warnings=False' in ansible.cfg to get rid of this message.
changed: [10.0.0.xx]

TASK [oracle_dg : add bash_profile for grid] ********************************************************************************************************************************************
skipping: [10.0.0.xxx] => (item={u'line': u' '}) 
skipping: [10.0.0.xxx] => (item={u'line': u'### for grid '}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export LANG=en_US.UTF-8'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK'}) 
skipping: [10.0.0.xxx] => (item={u'line': u' '}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_BASE=/u01/app/grid'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'### for grid '}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_HOME=/u01/app/19.3.0/grid'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export LANG=en_US.UTF-8'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_BASE=/u01/app/grid'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_HOME=/u01/app/19.3.0/grid'}) 
ok: [10.0.0.xx] => (item={u'line': u' '})
ok: [10.0.0.xx] => (item={u'line': u'### for grid '})
ok: [10.0.0.xx] => (item={u'line': u'export LANG=en_US.UTF-8'})
ok: [10.0.0.xx] => (item={u'line': u'export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK'})
ok: [10.0.0.xx] => (item={u'line': u'export ORACLE_BASE=/u01/app/grid'})
ok: [10.0.0.xx] => (item={u'line': u'export ORACLE_HOME=/u01/app/19.3.0/grid'})

TASK [oracle_dg : add bash_profile for oracle] ******************************************************************************************************************************************
skipping: [10.0.0.xxx] => (item={u'line': u' '}) 
skipping: [10.0.0.xxx] => (item={u'line': u'### for oracle '}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export LANG=en_US.UTF-8'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_BASE=/u01/app/oracle'}) 
skipping: [10.0.0.xxx] => (item={u'line': u' '}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_HOME=/u01/app/oracle/product/19.3.0/db'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'### for oracle '}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export LANG=en_US.UTF-8'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_BASE=/u01/app/oracle'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_HOME=/u01/app/oracle/product/19.3.0/db'}) 
ok: [10.0.0.xx] => (item={u'line': u' '})
ok: [10.0.0.xx] => (item={u'line': u'### for oracle '})
ok: [10.0.0.xx] => (item={u'line': u'export LANG=en_US.UTF-8'})
ok: [10.0.0.xx] => (item={u'line': u'export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK'})
ok: [10.0.0.xx] => (item={u'line': u'export ORACLE_BASE=/u01/app/oracle'})
ok: [10.0.0.xx] => (item={u'line': u'export ORACLE_HOME=/u01/app/oracle/product/19.3.0/db'})

TASK [oracle_dg : create directory for oracle home] *************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : add bash_profile for oracle] ******************************************************************************************************************************************
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_BASE=/u01/app/oracle'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_HOME=/u01/app/oracle/product/19.3.0/db'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_SID=orcl'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export PATH=$ORACLE_HOME/bin:$PATH'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_BASE=/u01/app/oracle'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_HOME=/u01/app/oracle/product/19.3.0/db'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export ORACLE_SID=orcl'}) 
skipping: [10.0.0.xxx] => (item={u'line': u'export PATH=$ORACLE_HOME/bin:$PATH'}) 
ok: [10.0.0.xx] => (item={u'line': u'export ORACLE_BASE=/u01/app/oracle'})
ok: [10.0.0.xx] => (item={u'line': u'export ORACLE_HOME=/u01/app/oracle/product/19.3.0/db'})
ok: [10.0.0.xx] => (item={u'line': u'export ORACLE_SID=orcl'})
ok: [10.0.0.xx] => (item={u'line': u'export PATH=$ORACLE_HOME/bin:$PATH'})

TASK [oracle_dg : copy db.rsp] **********************************************************************************************************************************************************
skipping: [10.0.0.xxx] => (item=db.rsp) 
skipping: [10.0.0.xxx] => (item=db.rsp) 
ok: [10.0.0.xx] => (item=db.rsp)

TASK [oracle_dg : chenge owner for response file] ***************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : copy and unzip db file] ***********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
[WARNING]: Consider using the unarchive module rather than running 'unzip'.  If you need to use command because unarchive is insufficient you can add 'warn: false' to this command task
or set 'command_warnings=False' in ansible.cfg to get rid of this message.
changed: [10.0.0.xx]

TASK [oracle_dg : change dir oracle home files permission] ******************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : execute database  soft installation] **********************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
fatal: [10.0.0.xx]: FAILED! => {"changed": true, "cmd": "/u01/app/oracle/product/19.3.0/db/runInstaller -silent -force -responseFile /tmp/db.rsp -ignorePrereq -ignoreInternalDriverError -waitforcompletion", "delta": "0:01:12.512206", "end": "2024-04-19 16:39:53.076090", "msg": "non-zero return code", "rc": 6, "start": "2024-04-19 16:38:40.563884", "stderr": "", "stderr_lines": [], "stdout": "Launching Oracle Database Setup Wizard...\n\n[WARNING] [INS-13014] Target environment does not meet some optional requirements.\n   CAUSE: Some of the optional prerequisites are not met. See logs for details. installActions2024-04-19_04-38-40PM.log\n   ACTION: Identify the list of failed prerequisite checks from the log: installActions2024-04-19_04-38-40PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.\nThe response file for this session can be found at:\n /u01/app/oracle/product/19.3.0/db/install/response/db_2024-04-19_04-38-40PM.rsp\n\nYou can find the log of this install session at:\n /tmp/InstallActions2024-04-19_04-38-40PM/installActions2024-04-19_04-38-40PM.log\n\nAs a root user, execute the following script(s):\n\t1. /u01/app/oraInventory/orainstRoot.sh\n\t2. /u01/app/oracle/product/19.3.0/db/root.sh\n\nExecute /u01/app/oraInventory/orainstRoot.sh on the following nodes: \n[dbca_stby]\nExecute /u01/app/oracle/product/19.3.0/db/root.sh on the following nodes: \n[dbca_stby]\n\n\nSuccessfully Setup Software with warning(s).\nMoved the install session logs to:\n /u01/app/oraInventory/logs/InstallActions2024-04-19_04-38-40PM", "stdout_lines": ["Launching Oracle Database Setup Wizard...", "", "[WARNING] [INS-13014] Target environment does not meet some optional requirements.", "   CAUSE: Some of the optional prerequisites are not met. See logs for details. installActions2024-04-19_04-38-40PM.log", "   ACTION: Identify the list of failed prerequisite checks from the log: installActions2024-04-19_04-38-40PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.", "The response file for this session can be found at:", " /u01/app/oracle/product/19.3.0/db/install/response/db_2024-04-19_04-38-40PM.rsp", "", "You can find the log of this install session at:", " /tmp/InstallActions2024-04-19_04-38-40PM/installActions2024-04-19_04-38-40PM.log", "", "As a root user, execute the following script(s):", "\t1. /u01/app/oraInventory/orainstRoot.sh", "\t2. /u01/app/oracle/product/19.3.0/db/root.sh", "", "Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes: ", "[dbca_stby]", "Execute /u01/app/oracle/product/19.3.0/db/root.sh on the following nodes: ", "[dbca_stby]", "", "", "Successfully Setup Software with warning(s).", "Moved the install session logs to:", " /u01/app/oraInventory/logs/InstallActions2024-04-19_04-38-40PM"]}
...ignoring

TASK [oracle_dg : root.sh script for dg node] *******************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : root.sh script for dg node] *******************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : set listener.ora for rac node1] ***************************************************************************************************************************************
skipping: [10.0.0.xx] => (item=##FOR DG BEGIN) 
skipping: [10.0.0.xx] => (item=SID_LIST_LISTENER =) 
skipping: [10.0.0.xx] => (item=    (SID_LIST =) 
skipping: [10.0.0.xx] => (item=            (SID_DESC =) 
skipping: [10.0.0.xx] => (item=                    (GLOBAL_DBNAME = orcl)) 
skipping: [10.0.0.xx] => (item=                    (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db)) 
skipping: [10.0.0.xx] => (item=                    (SID_NAME = orcl1)) 
skipping: [10.0.0.xx] => (item=            )) 
skipping: [10.0.0.xxx] => (item=##FOR DG BEGIN) 
skipping: [10.0.0.xx] => (item=    )) 
skipping: [10.0.0.xxx] => (item=SID_LIST_LISTENER =) 
skipping: [10.0.0.xx] => (item=##FOR DG END) 
skipping: [10.0.0.xxx] => (item=    (SID_LIST =) 
skipping: [10.0.0.xxx] => (item=            (SID_DESC =) 
skipping: [10.0.0.xxx] => (item=                    (GLOBAL_DBNAME = orcl)) 
skipping: [10.0.0.xxx] => (item=                    (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db)) 
skipping: [10.0.0.xxx] => (item=                    (SID_NAME = orcl1)) 
skipping: [10.0.0.xxx] => (item=            )) 
skipping: [10.0.0.xxx] => (item=    )) 
skipping: [10.0.0.xxx] => (item=##FOR DG END) 
ok: [10.0.0.xxx] => (item=##FOR DG BEGIN)
ok: [10.0.0.xxx] => (item=SID_LIST_LISTENER =)
ok: [10.0.0.xxx] => (item=    (SID_LIST =)
ok: [10.0.0.xxx] => (item=            (SID_DESC =)
ok: [10.0.0.xxx] => (item=                    (GLOBAL_DBNAME = orcl))
ok: [10.0.0.xxx] => (item=                    (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db))
ok: [10.0.0.xxx] => (item=                    (SID_NAME = orcl1))
ok: [10.0.0.xxx] => (item=            ))
ok: [10.0.0.xxx] => (item=    ))
ok: [10.0.0.xxx] => (item=##FOR DG END)

TASK [oracle_dg : set listener.ora for rac node2] ***************************************************************************************************************************************
skipping: [10.0.0.xx] => (item=##FOR DG BEGIN) 
skipping: [10.0.0.xx] => (item=SID_LIST_LISTENER =) 
skipping: [10.0.0.xx] => (item=    (SID_LIST =) 
skipping: [10.0.0.xx] => (item=            (SID_DESC =) 
skipping: [10.0.0.xxx] => (item=##FOR DG BEGIN) 
skipping: [10.0.0.xxx] => (item=SID_LIST_LISTENER =) 
skipping: [10.0.0.xx] => (item=                    (GLOBAL_DBNAME = orcl)) 
skipping: [10.0.0.xxx] => (item=    (SID_LIST =) 
skipping: [10.0.0.xx] => (item=                    (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db)) 
skipping: [10.0.0.xxx] => (item=            (SID_DESC =) 
skipping: [10.0.0.xx] => (item=                    (SID_NAME = orcl2)) 
skipping: [10.0.0.xxx] => (item=                    (GLOBAL_DBNAME = orcl)) 
skipping: [10.0.0.xx] => (item=            )) 
skipping: [10.0.0.xxx] => (item=                    (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db)) 
skipping: [10.0.0.xxx] => (item=                    (SID_NAME = orcl2)) 
skipping: [10.0.0.xx] => (item=    )) 
skipping: [10.0.0.xxx] => (item=            )) 
skipping: [10.0.0.xx] => (item=##FOR DG END) 
skipping: [10.0.0.xxx] => (item=    )) 
skipping: [10.0.0.xxx] => (item=##FOR DG END) 
ok: [10.0.0.xxx] => (item=##FOR DG BEGIN)
ok: [10.0.0.xxx] => (item=SID_LIST_LISTENER =)
ok: [10.0.0.xxx] => (item=    (SID_LIST =)
ok: [10.0.0.xxx] => (item=            (SID_DESC =)
ok: [10.0.0.xxx] => (item=                    (GLOBAL_DBNAME = orcl))
ok: [10.0.0.xxx] => (item=                    (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db))
ok: [10.0.0.xxx] => (item=                    (SID_NAME = orcl2))
ok: [10.0.0.xxx] => (item=            ))
ok: [10.0.0.xxx] => (item=    ))
ok: [10.0.0.xxx] => (item=##FOR DG END)

TASK [oracle_dg : stop lsnrctl for rac node1] *******************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xxx]

TASK [oracle_dg : start lsnrctl for rac node1] ******************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xxx]

TASK [oracle_dg : set listener.ora for rac dg] ******************************************************************************************************************************************
skipping: [10.0.0.xxx] => (item=##FOR DG BEGIN) 
skipping: [10.0.0.xxx] => (item=SID_LIST_LISTENER =) 
skipping: [10.0.0.xxx] => (item=    (SID_LIST =) 
skipping: [10.0.0.xxx] => (item=            (SID_DESC =) 
skipping: [10.0.0.xxx] => (item=                    (GLOBAL_DBNAME = orcl_stby)) 
skipping: [10.0.0.xxx] => (item=                    (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db)) 
skipping: [10.0.0.xxx] => (item=                    (SID_NAME = orcl_stby)) 
skipping: [10.0.0.xxx] => (item=            )) 
skipping: [10.0.0.xxx] => (item=    )) 
skipping: [10.0.0.xxx] => (item=##FOR DG BEGIN) 
skipping: [10.0.0.xxx] => (item=##FOR DG END) 
skipping: [10.0.0.xxx] => (item=SID_LIST_LISTENER =) 
skipping: [10.0.0.xxx] => (item=    (SID_LIST =) 
skipping: [10.0.0.xxx] => (item=            (SID_DESC =) 
skipping: [10.0.0.xxx] => (item=                    (GLOBAL_DBNAME = orcl_stby)) 
skipping: [10.0.0.xxx] => (item=                    (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db)) 
skipping: [10.0.0.xxx] => (item=                    (SID_NAME = orcl_stby)) 
skipping: [10.0.0.xxx] => (item=            )) 
skipping: [10.0.0.xxx] => (item=    )) 
skipping: [10.0.0.xxx] => (item=##FOR DG END) 
changed: [10.0.0.xx] => (item=##FOR DG BEGIN)
changed: [10.0.0.xx] => (item=SID_LIST_LISTENER =)
changed: [10.0.0.xx] => (item=    (SID_LIST =)
changed: [10.0.0.xx] => (item=            (SID_DESC =)
changed: [10.0.0.xx] => (item=                    (GLOBAL_DBNAME = orcl_stby))
changed: [10.0.0.xx] => (item=                    (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db))
changed: [10.0.0.xx] => (item=                    (SID_NAME = orcl_stby))
changed: [10.0.0.xx] => (item=            ))
changed: [10.0.0.xx] => (item=    ))
changed: [10.0.0.xx] => (item=##FOR DG END)

TASK [oracle_dg : stop lsnrctl for dg node] *********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : start lsnrctl for dg node] ********************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : copy tnsnames for all node] *******************************************************************************************************************************************
changed: [10.0.0.xx] => (item=tnsnames.ora)
ok: [10.0.0.xxx] => (item=tnsnames.ora)
ok: [10.0.0.xxx] => (item=tnsnames.ora)

TASK [oracle_dg : chenge owner for tnsnames file] ***************************************************************************************************************************************
changed: [10.0.0.xx]
changed: [10.0.0.xxx]
changed: [10.0.0.xxx]

TASK [oracle_dg : copy force_logging standbylogfile sql] ********************************************************************************************************************************
skipping: [10.0.0.xx] => (item=check_force_logging.sql) 
skipping: [10.0.0.xx] => (item=check_standbylogfile.sql) 
skipping: [10.0.0.xx] => (item=open_force_logging.sql) 
skipping: [10.0.0.xx] => (item=add_standbylogfile.sql) 
skipping: [10.0.0.xxx] => (item=check_force_logging.sql) 
skipping: [10.0.0.xxx] => (item=check_standbylogfile.sql) 
skipping: [10.0.0.xxx] => (item=open_force_logging.sql) 
skipping: [10.0.0.xxx] => (item=add_standbylogfile.sql) 
ok: [10.0.0.xxx] => (item=check_force_logging.sql)
ok: [10.0.0.xxx] => (item=check_standbylogfile.sql)
ok: [10.0.0.xxx] => (item=open_force_logging.sql)
ok: [10.0.0.xxx] => (item=add_standbylogfile.sql)

TASK [oracle_dg : check force_logging sql] **********************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xxx]

TASK [oracle_dg : debug] ****************************************************************************************************************************************************************
skipping: [10.0.0.xx]
ok: [10.0.0.xxx] => {
    "msg": "database is already in force logging mode YES"
}
skipping: [10.0.0.xxx]

TASK [oracle_dg : execute open database force_logging sql] ******************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : check database standbylogfile sql] ************************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xxx]

TASK [oracle_dg : debug] ****************************************************************************************************************************************************************
skipping: [10.0.0.xx]
ok: [10.0.0.xxx] => {
    "msg": "database current standbylogfile is 6"
}
skipping: [10.0.0.xxx]

TASK [oracle_dg : execute database add standbylogfile sql] ******************************************************************************************************************************
skipping: [10.0.0.xx]
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]

TASK [oracle_dg : create database data dir directory on dg node] ************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

TASK [oracle_dg : create database archived dir directory on dg node] ********************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
ok: [10.0.0.xx]

TASK [oracle_dg : execute dg database installation] *************************************************************************************************************************************
skipping: [10.0.0.xxx]
skipping: [10.0.0.xxx]
changed: [10.0.0.xx]

PLAY RECAP ******************************************************************************************************************************************************************************
10.0.0.xxx                 : ok=16   changed=5    unreachable=0    failed=0    skipped=87   rescued=0    ignored=2   
10.0.0.xxx                 : ok=9    changed=1    unreachable=0    failed=0    skipped=94   rescued=0    ignored=2   
10.0.0.xx                  : ok=77   changed=34   unreachable=0    failed=0    skipped=26   rescued=0    ignored=1   

安装完成后使用dgbroker管理DG

主库:
asmcmd mkdir  /DATA/dgtest  grid用户创建目录

ALTER SYSTEM SET DB_FILE_NAME_CONVERT='/home/oracle/oradata/ORCL_STBY/datafile','+DATA' SCOPE=SPFILE;
ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='/home/oracle/oradata/ORCL_STBY/datafile/orcl/onlinelog','+DATA' SCOPE=SPFILE;
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO sid='*';
alter system set dg_broker_config_file1='+DATA/dgtest/dr1orcl.dat'  SID='*' scope=both;
alter system set dg_broker_config_file2='+DATA/dgtest/dr2orcl.dat'  SID='*' scope=both;
ALTER SYSTEM SET dg_broker_start=true  SID='*' scope=both;

从库:
ALTER SYSTEM SET dg_broker_start=false scope=both;
ALTER SYSTEM SET DB_FILE_NAME_CONVERT='+DATA', '/home/oracle/oradata/ORCL_STBY/datafile' SCOPE=SPFILE sid='*';
ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='+DATA','/home/oracle/oradata/ORCL_STBY/datafile/orcl/onlinelog' SCOPE=SPFILE sid='*';
alter system set dg_broker_config_file1='/u01/app/oracle/product/19.3.0/db/dbs/dr1orcl.dat'  SID='*' scope=both;
alter system set dg_broker_config_file2='/u01/app/oracle/product/19.3.0/db/dbs/dr2orcl.dat'  SID='*' scope=both;
ALTER SYSTEM SET dg_broker_start=true scope=both;
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;

主库:
vim config_primary_stby_database.sql CREATE CONFIGURATION dg_config AS PRIMARY DATABASE IS orcl CONNECT IDENTIFIER IS orcl; ADD DATABASE orcl_stby AS CONNECT IDENTIFIER IS orcl_stby MAINTAINED AS PHYSICAL; ENABLE CONFIGURATION; SHOW CONFIGURATION;

dgmgrl sys/Ora_2023_1234@orcl @config_primary_stby_database.sql

 

查看状态信息

DGMGRL> show CONFIGURATION

Configuration - dg_config

  Protection Mode: MaxPerformance
  Members:
  orcl      - Primary database
    orcl_stby - Physical standby database 

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 49 second ago)

DGMGRL> show DATABASE VERBOSE orcl_stby;

Database - orcl_stby

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      0 seconds (computed 0 seconds ago)
  Apply Lag:          0 seconds (computed 0 seconds ago)
  Average Apply Rate: 2.00 KByte/s
  Active Apply Rate:  1.77 MByte/s
  Maximum Apply Rate: 4.11 MByte/s
  Real Time Query:    ON
  Instance(s):
    orcl

  Properties:
    DGConnectIdentifier             = 'orcl_stby'
    ObserverConnectIdentifier       = ''
    FastStartFailoverTarget         = ''
    PreferredObserverHosts          = ''
    LogShipping                     = 'ON'
    RedoRoutes                      = ''
    LogXptMode                      = 'ASYNC'
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'
    RedoCompression                 = 'DISABLE'
    PreferredApplyInstance          = ''
    ApplyInstanceTimeout            = '0'
    ApplyLagThreshold               = '30'
    TransportLagThreshold           = '30'
    TransportDisconnectedThreshold  = '30'
    ApplyParallel                   = 'AUTO'
    ApplyInstances                  = '0'
    StandbyFileManagement           = ''
    ArchiveLagTarget                = '0'
    LogArchiveMaxProcesses          = '0'
    LogArchiveMinSucceedDest        = '0'
    DataGuardSyncLatency            = '0'
    LogArchiveTrace                 = '0'
    LogArchiveFormat                = ''
    DbFileNameConvert               = ''
    LogFileNameConvert              = ''
    ArchiveLocation                 = ''
    AlternateLocation               = ''
    StandbyArchiveLocation          = ''
    StandbyAlternateLocation        = ''
    InconsistentProperties          = '(monitor)'
    InconsistentLogXptProps         = '(monitor)'
    LogXptStatus                    = '(monitor)'
    SendQEntries                    = '(monitor)'
    RecvQEntries                    = '(monitor)'
    HostName                        = 'dbca_stby'
    StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbca_stby)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl_stby_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))'
    TopWaitEvents                   = '(monitor)'
    SidName                         = '(monitor)'

  Log file locations:
    Alert log               : /u01/app/oracle/diag/rdbms/orcl_stby/orcl/trace/alert_orcl.log
    Data Guard Broker log   : /u01/app/oracle/diag/rdbms/orcl_stby/orcl/trace/drcorcl.log

Database Status:
SUCCESS

DGMGRL>  show DATABASE VERBOSE orcl;

Database - orcl

  Role:               PRIMARY
  Intended State:     TRANSPORT-ON
  Instance(s):
    orcl1
    orcl2

  Properties:
    DGConnectIdentifier             = 'orcl'
    ObserverConnectIdentifier       = ''
    FastStartFailoverTarget         = ''
    PreferredObserverHosts          = ''
    LogShipping                     = 'ON'
    RedoRoutes                      = ''
    LogXptMode                      = 'ASYNC'
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'
    RedoCompression                 = 'DISABLE'
    PreferredApplyInstance          = ''
    ApplyInstanceTimeout            = '0'
    ApplyLagThreshold               = '30'
    TransportLagThreshold           = '30'
    TransportDisconnectedThreshold  = '30'
    ApplyParallel                   = 'AUTO'
    ApplyInstances                  = '0'
    StandbyFileManagement           = ''
    ArchiveLagTarget                = '0'
    LogArchiveMaxProcesses          = '0'
    LogArchiveMinSucceedDest        = '0'
    DataGuardSyncLatency            = '0'
    LogArchiveTrace                 = '0'
    LogArchiveFormat                = ''
    DbFileNameConvert               = ''
    LogFileNameConvert              = ''
    ArchiveLocation                 = ''
    AlternateLocation               = ''
    StandbyArchiveLocation          = ''
    StandbyAlternateLocation        = ''
    InconsistentProperties          = '(monitor)'
    InconsistentLogXptProps         = '(monitor)'
    LogXptStatus                    = '(monitor)'
    SendQEntries                    = '(monitor)'
    RecvQEntries                    = '(monitor)'
    HostName(*)
    StaticConnectIdentifier(*)
    TopWaitEvents(*)
    SidName(*)
    (*) - Please check specific instance for the property value

  Log file locations(*):
    (*) - Check specific instance for log file locations.

Database Status:
SUCCESS

主库:

SQL> set linesize 200
SQL> select name, database_role db_role, controlfile_type cf_type, open_mode, protection_mode, dataguard_broker dg_broker, guard_status, force_logging from v$database;


NAME DB_ROLE CF_TYPE OPEN_MODE PROTECTION_MODE DG_BROKE GUARD_S FORCE_LOGGING
--------- ---------------- ------- -------------------- -------------------- -------- ------- ---------------------------------------
ORCL PRIMARY CURRENT READ WRITE MAXIMUM PERFORMANCE ENABLED NONE YES

从库:

SQL> set linesize 200
SQL> select name, database_role db_role, controlfile_type cf_type, open_mode, protection_mode, dataguard_broker dg_broker, guard_status, force_logging from v$database;


NAME DB_ROLE CF_TYPE OPEN_MODE PROTECTION_MODE DG_BROKE GUARD_S FORCE_LOGGING
--------- ---------------- ------- -------------------- -------------------- -------- ------- ---------------------------------------
ORCL PHYSICAL STANDBY STANDBY READ ONLY WITH APPLY MAXIMUM PERFORMANCE ENABLED NONE YES

 

 切换测试

DGMGRL> SWITCHOVER TO orcl_stby;
Performing switchover NOW, please wait...
New primary database "orcl_stby" is opening...
Oracle Clusterware is restarting database "orcl" ...

Connected to "orcl"
Switchover succeeded, new primary is "orcl_stby"
DGMGRL>


DGMGRL> show CONFIGURATION

Configuration - dg_config

  Protection Mode: MaxPerformance
  Members:
  orcl_stby - Primary database
    orcl      - Physical standby database 

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 89 seconds ago)

回切:

DGMGRL> SWITCHOVER TO  orcl
Performing switchover NOW, please wait...
Operation requires a connection to database "orcl"
Connecting ...
Connected to "orcl"
Connected as SYSDBA.
New primary database "orcl" is opening...
Operation requires start up of instance "orcl" on database "orcl_stby"
Starting instance "orcl"...
Connected to an idle instance.
ORACLE instance started.
Connected to "orcl_stby"
Database mounted.
Database opened.
Switchover succeeded, new primary is "orcl"
DGMGRL> show configuration

Configuration - dg_config

  Protection Mode: MaxPerformance
  Members:
  orcl      - Primary database
    orcl_stby - Physical standby database 

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 20 seconds ago)

DGMGRL> 

 

posted @ 2024-04-25 16:54  zetan·chen  阅读(80)  评论(1编辑  收藏  举报