10

11g ADG级联备库基础测试环境准备 - AlfredZhao

 1 year ago
source link: https://www.cnblogs.com/jyzhao/p/17396592.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

客户通过duplicate生产备库的方式创建cascade备库。
发现每次都会遇到两个文件报错,ORA-17628: Oracle error 19505错误,且每一次跑,报错文件不一样。

现在想帮客户验证,这属于是正常现象还是bug;
本文需要先模拟客户11.2.0.3环境,构建备库、级联备库环境;

一、构造测试环境

1.搭建3套11.2.0.3环境

自己测试资源有限,只有一个11.2.0.3的单实例,然后以此为模版克隆两台分别用作备库和级联备库。
克隆前需要将模版先挂起:

# virsh suspend db11g
# virt-clone --original db11g --name db11gadg --auto-clone

使用nohup后台进行克隆,避免中断:

nohup virt-clone --original db11g --name db11gadg --auto-clone &
nohup virt-clone --original db11g --name db11gcas --auto-clone &

克隆两台的动作只能串行,并行会有明确错误提示。
即便串行,查看日志发现5分钟内也能搞定这个克隆动作。

[root@bogon ~]# tail -20f nohup.out 
WARNING  Setting the graphics device port to autoport, in order to avoid conflicting.
Allocating 'db11gadg.img'                                   |  10 GB  00:16     
Allocating 'db1-lun1-clone-2-clone.img'                     | 100 GB  02:09     

Clone 'db11gadg' created successfully.
WARNING  Setting the graphics device port to autoport, in order to avoid conflicting.
Allocating 'db11gcas.img'                                   |  10 GB  00:14     
Allocating 'db1-lun1-clone-2-clone-1.img'                   | 100 GB  02:01     

Clone 'db11gcas' created successfully.

克隆完成后,恢复模版并打开克隆的环境,确认均正常运行:

# virsh resume db11g

# virsh start db11gadg
# virsh start db11gcas

# virsh list --all
[root@bogon ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 ...
 11    db11g                          running
 12    db11gadg                       running
 13    db11gcas                       running
 ...

2.规划主机名和IP地址并设置

db11g IP地址是 192.168.1.18
db11gadg IP地址是 192.168.1.19
db11gcas IP地址是 192.168.1.20

# db11gadg
[root@bogon ~]# virsh console db11gadg

hostnamectl set-hostname db11gadg
vi /etc/hosts
vi /etc/sysconfig/network-scripts/ifcfg-eth0
vi /etc/sysconfig/network-scripts/ifcfg-ens9	<-- 这里是我特有的一个网卡,你若没有可以不设置,不影响本次测试
reboot

# db11gcas
[root@bogon ~]# virsh console db11gcas

hostnamectl set-hostname db11gcas
vi /etc/hosts
vi /etc/sysconfig/network-scripts/ifcfg-eth0
vi /etc/sysconfig/network-scripts/ifcfg-ens9
reboot

3.清除没有用的数据库

db11gadg 和 db11gcas 只需要保留Oracle软件,原有数据库实例删除掉。
监听文件的配置,里面也有主机名信息,按实际改下即可。

删除Oracle实例(稍微有些繁琐,但这也是成熟的表现,毕竟删库这种事情就要搞的门槛高些,避免误操作)

比如使用SQL直接删除在运行中的数据库,直接提示不被允许:

SQL> drop database;
drop database
*
ERROR at line 1:
ORA-01586: database must be mounted EXCLUSIVE and not open for this operation

rman操作同样直接提示不被允许:

[oracle@db11gcas ~]$ rman target /      

Recovery Manager: Release 11.2.0.3.0 - Production on Fri May 12 23:30:19 2023

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: JINGYU (DBID=3834912727)

RMAN> drop database;

database name is "JINGYU" and DBID is 3834912727

Do you really want to drop the database (enter YES or NO)? yes
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
ORA-01586: database must be mounted EXCLUSIVE and not open for this operation

RMAN> 

按文档建议步骤,使用rman删除数据库

rman target /
RMAN> STARTUP FORCE MOUNT
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
RMAN> DROP DATABASE INCLUDING BACKUPS NOPROMPT;

...
database name is "JINGYU" and DBID is 3834912727

database dropped

纯SQL操作也是OK的:

SQL> STARTUP FORCE MOUNT
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> DROP DATABASE

先把测试环境准备好了,周末找时间再继续测。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK