rac restore to single instance

本文介绍了一种使用RMAN备份及恢复工具将Oracle RAC数据库迁移到单实例数据库的方法。包括了从备份生产环境的RAC数据库到恢复并调整配置以适应新主机的过程。

Solution
1) Take appropriate RMAN backup of the production RAC database. Note that you should turn on the CONTROLFILE AUTOBACKUP configuration so that we have the controlfile backed up after the database backup. When we restore the controlfile on new host from this autobackup piece, it will have the information of the latest backup.
RMAN> run{
2> allocate channel c1 type disk format '/oracle/10g/backup/%U';
3> backup database;
4> backup archivelog all;
5> }

allocated channel: c1
channel c1: sid=133 instance=racdb1 devtype=DISK

Starting backup at 12-FEB-07
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00001 name=/ocfs2/oradata/racdb/system01.dbf
input datafile fno=00002 name=/ocfs2/oradata/racdb/undotbs01.dbf
input datafile fno=00005 name=/ocfs2/oradata/racdb/undotbs02.dbf
input datafile fno=00003 name=/ocfs2/oradata/racdb/sysaux01.dbf
input datafile fno=00004 name=/ocfs2/oradata/racdb/users01.dbf
channel c1: starting piece 1 at 12-FEB-07
channel c1: finished piece 1 at 12-FEB-07
piece handle=/oracle/10g/backup/09i9sruq_1_1 tag=TAG20070212T162458 comment=NONE
channel c1: backup set complete, elapsed time: 00:01:05
Finished backup at 12-FEB-07

Starting backup at 12-FEB-07
current log archived
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=56 recid=3 stamp=613417105
input archive log thread=1 sequence=57 recid=4 stamp=613417106
input archive log thread=1 sequence=58 recid=5 stamp=614363168
input archive log thread=2 sequence=1 recid=1 stamp=613417090
input archive log thread=2 sequence=2 recid=2 stamp=613417093
input archive log thread=2 sequence=3 recid=6 stamp=614363170
channel c1: starting piece 1 at 12-FEB-07
channel c1: finished piece 1 at 12-FEB-07
piece handle=/oracle/10g/backup/0ai9ss14_1_1 tag=TAG20070212T162610 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:04
Finished backup at 12-FEB-07

Starting Control File and SPFILE Autobackup at 12-FEB-07
piece handle=/oracle/10g/backup/c-610677177-20070212-00 comment=NONE
Finished Control File and SPFILE Autobackup at 12-FEB-07
released channel: c12) Create a PFILE for the single instance database using the production RAC parameter file
a) don't forget to modify the following parameters depending on the directory structure of the new host: audit_file_dest, background_dump_dest, control_files, core_dump_dest, log_archive_dest_1, user_dump_dest etc
b) remove RAC specific parameters such as cluster_database_instances, cluster_database etc
c) for the parameter undo_tablespace, mention any one undo tablespace name

3) Move the backup pieces and the modified INIT.ORA file to the new host. Starting from 10g it is NO longer compulsory to copy the RMAN backup pieces to exactly the same location on the new host as the production location.

4) Use the pfile created above to STARTUP NOMOUNT the database on the new host
oracle@test-br ractest]$ sqlplus "/ as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Feb 16 03:14:23 2007

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1218292 bytes
Variable Size              62916876 bytes
Database Buffers           96468992 bytes
Redo Buffers                7168000 bytes5) Now invoke RMAN and restore the controlfile specifying the location where the controlfile autobackup piece is restored on this new server. You can mount the database once the controlfile is restored successfully.
[oracle@test-br ractest]$ rman target / nocatalog

Recovery Manager: Release 10.2.0.1.0 - Production on Fri Feb 16 03:16:31 2007

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: racdb (not mounted)
using target database control file instead of recovery catalog

RMAN> restore controlfile from '/u01/oracle/oradata/ractest/c-610677177-20070212-00';

Starting restore at 16-FEB-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output filename=/u01/oracle/oradata/ractest/control01.ctl
Finished restore at 16-FEB-07

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_16) You can skip this step if you have restored the RMAN backup pieces to exactly the same location they were backed up on production. If this is not the case then you need to catalog the RMAN backup pieces to make RMAN aware of thier new location on the new host. Note that CATALOG BACKUPPIECE command is available only starting from 10g.
RMAN> catalog backuppiece '/u01/oracle/oradata/ractest/09i9sruq_1_1';

cataloged backuppiece
backup piece handle=/u01/oracle/oradata/ractest/09i9sruq_1_1 recid=10 stamp=614661579

RMAN> catalog backuppiece '/u01/oracle/oradata/ractest/0ai9ss14_1_1';

cataloged backuppiece
backup piece handle=/u01/oracle/oradata/ractest/0ai9ss14_1_1 recid=11 stamp=6146615997) Now we'll determine the point upto which media recovery should run on the restored database.
RMAN> list backup of archivelog all;

List of Archived Logs in backup set 9
Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
---- ------- ---------- --------- ---------- ---------
1    56      214541     01-FEB-07 226238     01-FEB-07
1    57      226238     01-FEB-07 226240     01-FEB-07
1    58      226240     01-FEB-07 233107     12-FEB-07
2    1       186185     28-JAN-07 225714     01-FEB-07
2    2       225714     01-FEB-07 226037     01-FEB-07
2    3       226037     01-FEB-07 233110     12-FEB-07Check the last archive sequence for all redo threads and select the archive sequence having LEAST "Next SCN" among them. In our case sequence 58 of thread 1 has Next SCN of 233107 while sequence 3 of thread 2 has Next SCN of 233110. Since squence 58 of thread 1 has least Next SCN we will recover upto this point. (If you are keen to have recovery run until some specific time you can always give SET UNTIL TIME)

8) Having determined the point upto which media recovery should run, start the restore/recovery using:
RMAN> run {
2> set until sequence 59 thread 1;
3> set newname for datafile 1 to '/u01/oracle/oradata/ractest/data/system01.dbf';
4> set newname for datafile 2 to '/u01/oracle/oradata/ractest/data/undotbs01.dbf';
5> set newname for datafile 3 to '/u01/oracle/oradata/ractest/data/sysaux01.dbf';
6> set newname for datafile 4 to '/u01/oracle/oradata/ractest/data/users01.dbf';
7> set newname for datafile 5 to '/u01/oracle/oradata/ractest/data/undotbs02.dbf';
8> restore database;
9> switch datafile all;
10> recover database;
11> }Since we determined previously that media recovery should run until sequence 58 hence we use  SET UNTIL SEQUENCE 59 (+1) above. You also need to use SET NEWNAME clause to restore datafiles to a location on the new host which is different from the production path. Finally, SWITCH DATAFILE ALL clause updates these new datafile locations in the controlfile.

9) Once RMAN restore/recovery finishes, you will want to rename the online redolog files before opening the database in case the production path of redo log files is not available on the new host. After renaming the redolog files, the database can be opened with RESETLOGS
SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/ocfs2/oradata/racdb/redo01.log
/ocfs2/oradata/racdb/redo02.log
/ocfs2/oradata/racdb/redo03.log
/ocfs2/oradata/racdb/redo04.log
/ocfs2/oradata/racdb/redo05.log
/ocfs2/oradata/racdb/redo06.log

6 rows selected.

SQL> alter database rename file '/ocfs2/oradata/racdb/redo01.log' to '/u01/oracle/oradata/ractest/log/redo01.log';

Database altered.

SQL> alter database rename file '/ocfs2/oradata/racdb/redo02.log' to '/u01/oracle/oradata/ractest/log/redo02.log';

Database altered.

SQL> alter database rename file '/ocfs2/oradata/racdb/redo03.log' to '/u01/oracle/oradata/ractest/log/redo03.log';

Database altered.

SQL> alter database rename file '/ocfs2/oradata/racdb/redo04.log' to '/u01/oracle/oradata/ractest/log/redo04.log';

Database altered.

SQL> alter database rename file '/ocfs2/oradata/racdb/redo05.log' to '/u01/oracle/oradata/ractest/log/redo05.log';

Database altered.

SQL> alter database rename file '/ocfs2/oradata/racdb/redo06.log' to '/u01/oracle/oradata/ractest/log/redo06.log';

Database altered.

SQL> alter database open resetlogs;

Database altered.10) Once the database is opened successfully, you may remove the redolog groups for redo threads of other instances
SQL> select THREAD#, STATUS, ENABLED
  2  from v$thread;

   THREAD# STATUS ENABLED
---------- ------ --------
         1 OPEN   PUBLIC
         2 CLOSED PRIVATE

SQL> select group# from v$log where THREAD#=2;

    GROUP#
----------
         4
         5
         6

SQL> alter database disable thread 2;

Database altered.

SQL> alter database drop logfile group 4;
alter database drop logfile group 4
*
ERROR at line 1:
ORA-00350: log 4 of instance racdb2 (thread 2) needs to be archived
ORA-00312: online log 4 thread 2: '/u01/oracle/oradata/ractest/log/redo04.log'

SQL> alter database clear unarchived logfile group 4;

Database altered.

SQL> alter database drop logfile group 4;

Database altered.

SQL> alter database drop logfile group 5;

Database altered.

SQL> alter database drop logfile group 6;

Database altered.

SQL> select THREAD#, STATUS, ENABLED from v$thread;

   THREAD# STATUS ENABLED
---------- ------ --------
         1 OPEN   PUBLIC11) Now you can remove the undo tablespaces of other instances and create a new temporary tablespace to complete the activity.
SQL> sho parameter undo;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_management                      string      AUTO
undo_retention                       integer     900
undo_tablespace                      string      UNDOTBS1
SQL>
SQL>
SQL> select tablespace_name from dba_tablespaces where contents='UNDO';

TABLESPACE_NAME
------------------------------
UNDOTBS1
UNDOTBS2

SQL> drop tablespace UNDOTBS2 including contents and datafiles;

Tablespace dropped.

SQL> select name from v$tempfile;

NAME
--------------------------------------------------------------------------------
/ocfs2/oradata/racdb/temp01.dbf


SQL> select tablespace_name from dba_tablespaces where contents='TEMPORARY';

TABLESPACE_NAME
------------------------------
TEMP

SQL> create temporary tablespace TEMP1
  2  tempfile '/u01/oracle/oradata/ractest/data/temp01.dbf'
  3  size 50M;

Tablespace created.

SQL> alter database default temporary tablespace TEMP1;

Database altered.

SQL> drop tablespace TEMP including contents and datafiles;

Tablespace dropped.

 

【无人机】基于改进粒子群算法的无人机路径规划研究[和遗传算法、粒子群算法进行比较](Matlab代码实现)内容概要:本文围绕基于改进粒子群算法的无人机路径规划展开研究,重点探讨了在复杂环境中利用改进粒子群算法(PSO)实现无人机三维路径规划的方法,并将其与遗传算法(GA)、标准粒子群算法等传统优化算法进行对比分析。研究内容涵盖路径规划的多目标优化、避障策略、航路点约束以及算法收敛性和寻优能力的评估,所有实验均通过Matlab代码实现,提供了完整的仿真验证流程。文章还提到了多种智能优化算法在无人机路径规划中的应用比较,突出了改进PSO在收敛速度和全局寻优方面的优势。; 适合人群:具备一定Matlab编程基础和优化算法知识的研究生、科研人员及从事无人机路径规划、智能优化算法研究的相关技术人员。; 使用场景及目标:①用于无人机在复杂地形或动态环境下的三维路径规划仿真研究;②比较不同智能优化算法(如PSO、GA、蚁群算法、RRT等)在路径规划中的性能差异;③为多目标优化问题提供算法选型和改进思路。; 阅读建议:建议读者结合文中提供的Matlab代码进行实践操作,重点关注算法的参数设置、适应度函数设计及路径约束处理方式,同时可参考文中提到的多种算法对比思路,拓展到其他智能优化算法的研究与改进中。
### Oracle 12c PDB RAC 迁移至 RAC ADG 配置方案 #### 背景概述 将 Oracle 12c 的可插拔数据库 (PDB) 从一个 Real Application Clusters (RAC) 环境迁移到另一个 Active Data Guard (ADG) RAC 环境是一项复杂的任务,涉及多个阶段的操作。此过程不仅需要考虑数据一致性,还需要确保源环境和目标环境之间的兼容性和稳定性。 --- #### 实施步骤说明 ##### 1. 数据库版本验证与准备 在执行迁移之前,需确认源数据库(Oracle 12c RAC)和目标数据库(RAC ADG)的版本兼容性。如果目标环境为 Oracle 19c,则可以利用 Database Upgrade Assistant (DBUA) 或手动升级路径完成版本转换[^1]。此外,还需检查以下内容: - 源端和目标端的补丁级别是否一致。 - 是否满足目标环境中关于存储、网络和其他硬件资源的要求。 ##### 2. 创建物理备份集 为了减少停机时间并提高效率,在源 RAC 上创建完整的物理备份是非常重要的一步。可以通过 RMAN 工具实现这一操作: ```bash rman target / BACKUP PLUGGABLE DATABASE pdb_name FORMAT '/path/to/backup/%U'; ``` 上述命令会针对指定的 PDB 创建一份独立的备份文件集合[^2]。 ##### 3. 复制备份到目标主机 使用 SCP 或其他传输工具将上一环节生成的所有备份件复制到新集群中的节点之一。例如: ```bash scp /source/path/*.bkp user@target_host:/destination/path/ ``` 注意:确保目标位置有足够的磁盘空间来容纳这些大容量的数据块。 ##### 4. 设置目标侧初始化参数 基于实际需求调整目标实例上的 `init<sid>.ora` 文件或者通过 SPFILE 动态修改某些必要的运行时选项。比如设置归档日志模式开启状态以及定义合适的 UNDO 表空间大小等[^3]: ```sql ALTER SYSTEM SET db_create_file_dest='+DATADG' SCOPE=SPFILE; CREATE SPFILE FROM PFILE='/tmp/initbmacdb1.ora'; ``` 此处展示了如何依据现有模板重新构建一个新的服务器参数文件(SPFLE),从而简化后续恢复流程。 ##### 5. 执行恢复及切换为主库角色 最后一步是在新的 RAC 成员之上还原先前导出的内容,并将其激活成为主生产服务的一部分: ```sql RESTORE PLUGGABLE DATABASE pdb_name FROM TAG 'full_backup_tag'; RECOVER PLUGGABLE DATABASE pdb_name UNTIL CANCEL USING BACKUP CONTROLFILE; ALTER DATABASE OPEN READ WRITE; ALTER SESSION SET CONTAINER=pdb_name; ALTER PLUGGABLE DATABASE ALL SAVE STATE; ``` 以上脚本片段实现了从冷备份向热可用性的转变过程。 --- #### 注意事项 在整个过程中需要注意几个关键点以保障整个项目的成功落地: - **测试演练**:正式上线前务必安排多次全量模拟实验; - **监控性能指标**:密切跟踪 CPU 使用率、I/O 延迟等相关统计数值变化趋势; - **文档记录保持更新**:及时修订任何发现的问题及其解决方案以便未来参考学习之用。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值