Linux 7.9 平台下 Oracle 19.12 单实例使用RMAN迁移至单实例

源端 192.168.56.100 orcl
目标 192.168.56.101 orcl

https://www.cndba.cn/hbhe0316/article/4860

1.源端https://www.cndba.cn/hbhe0316/article/4860

SQL> create pfile='/tmp/pfile.ora' from spfile;

File created.

2.备份源端数据库

[oracle@rac01 ~]$ rman target /
RMAN> backup database format '/backup/datafile_%U';
RMAN> backup archivelog all format '/backup/arch_%U';
RMAN> backup current controlfile format '/backup/control.bak';


[oracle@db01 backup]$ scp * 192.168.56.101:/backup/

3.3.编辑参数文件,修改成单机的,传至目标环境

[root@db01 ~]# mkdir /oradata
[root@db01 ~]# mkdir /archivelog
[root@db01 ~]# chown oracle.oinstall /oradata/
[root@db01 ~]# chown oracle.oinstall /archivelog/
[oracle@db01 ~]$ cat /tmp/pfile.ora 
orcl.__data_transfer_cache_size=0
orcl.__db_cache_size=1174405120
orcl.__inmemory_ext_roarea=0
orcl.__inmemory_ext_rwarea=0
orcl.__java_pool_size=234881024
orcl.__large_pool_size=100663296
orcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=838860800
orcl.__sga_target=2516582400
orcl.__shared_io_pool_size=117440512
orcl.__shared_pool_size=872415232
orcl.__streams_pool_size=0
orcl.__unified_pga_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='19.0.0'
*.control_files='/u01/app/oracle/oradata/ORCL/control01.ctl','/u01/app/oracle/oradata/ORCL/control02.ctl'
*.db_block_size=8192
*.db_name='orcl'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.enable_pluggable_database=true
*.local_listener='LISTENER_ORCL'
*.log_archive_dest_1='location=/archivelog'
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.pga_aggregate_target=798m
*.processes=2000
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=2394m
*.undo_tablespace='UNDOTBS1'

4.目标端操作https://www.cndba.cn/hbhe0316/article/4860

sqlplus  /  as sysdba
create spfile from pfile='/tmp/pfile.ora';
startup nomount

5.恢复controlfile

[oracle@db01 tmp]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Oct 3 20:14:53 2021
Version 19.12.0.0.0

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

connected to target database: CXMTDB (not mounted)

RMAN> restore controlfile from '/backup/control.bak';

6.启动到mount:https://www.cndba.cn/hbhe0316/article/4860

SQL> alter database mount;

Database altered.



RMAN> catalog start  with '/backup';

released channel: ORA_DISK_1
searching for all files that match the pattern /backup

List of Files Unknown to the Database
=====================================
File Name: /backup/control.bak

Do you really want to catalog the above files (enter YES or NO)? YES
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /backup/control.bak




RMAN> list archivelog all;

List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================

Key     Thrd Seq     S Low Time          
------- ---- ------- - ------------------
1       1    15      A 2021:10:0417:43:34
        Name: /archivelog/1_15_1083088470.dbf

2       1    16      A 2021:10:0418:05:23
        Name: /archivelog/1_16_1083088470.dbf



SQL>                               select checkpoint_change# from v$database;

CHECKPOINT_CHANGE#
------------------
           2746531




RMAN> report schema;

RMAN-06139: warning: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name ORCL

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    0        SYSTEM               ***     /u01/app/oracle/oradata/ORCL/system01.dbf
3    0        SYSAUX               ***     /u01/app/oracle/oradata/ORCL/sysaux01.dbf
4    0        UNDOTBS1             ***     /u01/app/oracle/oradata/ORCL/undotbs01.dbf
5    0        PDB$SEED:SYSTEM      ***     /u01/app/oracle/oradata/ORCL/pdbseed/system01.dbf
6    0        PDB$SEED:SYSAUX      ***     /u01/app/oracle/oradata/ORCL/pdbseed/sysaux01.dbf
7    0        USERS                ***     /u01/app/oracle/oradata/ORCL/users01.dbf
8    0        PDB$SEED:UNDOTBS1    ***     /u01/app/oracle/oradata/ORCL/pdbseed/undotbs01.dbf
9    0        HBHE:SYSTEM          ***     /u01/app/oracle/oradata/ORCL/hbhe/system01.dbf
10   0        HBHE:SYSAUX          ***     /u01/app/oracle/oradata/ORCL/hbhe/sysaux01.dbf
11   0        HBHE:UNDOTBS1        ***     /u01/app/oracle/oradata/ORCL/hbhe/undotbs01.dbf
12   0        HBHE:USERS           ***     /u01/app/oracle/oradata/ORCL/hbhe/users01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/app/oracle/oradata/ORCL/temp01.dbf
2    36       PDB$SEED:TEMP        32767       /u01/app/oracle/oradata/ORCL/pdbseed/temp012021-09-12_18-03-03-954-PM.dbf
3    36       HBHE:TEMP            32767       /u01/app/oracle/oradata/ORCL/hbhe/temp01.dbf


run{
set NEWNAME for datafile 1 to '/oradata/orcl/system01.dbf';
set NEWNAME for datafile 3 to '/oradata/orcl/sysaux01.dbf';
set newname for datafile 4 to '/oradata/orcl/undotbs01.dbf';
set newname for datafile 5 to '/oradata/orcl/pdbseed/system01.dbf';
set newname for datafile 6 to '/oradata/orcl/pdbseed/sysaux01.dbf';
set newname for datafile 7 to '/oradata/orcl/users01.dbf';
set newname for datafile 8 to '/oradata/orcl/pdbseed/undotbs01.dbf';
set newname for datafile 9 to '/oradata/orcl/hbhe/system01.dbf';
set newname for datafile 10 to '/oradata/orcl/hbhe/sysaux01.dbf';
set newname for datafile 11 to '/oradata/orcl/hbhe/undotbs01.dbf';
set newname for datafile 12 to '/oradata/orcl/hbhe/users01.dbf';
restore database;
switch datafile all;
switch datafile all;
recover database;
}           

RMAN> recover database until sequence 17 thread 1;

7.更改redo log日志路径

https://www.cndba.cn/hbhe0316/article/4860
SQL>         select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ORCL/redo03.log
/u01/app/oracle/oradata/ORCL/redo02.log
/u01/app/oracle/oradata/ORCL/redo01.log


alter database rename file '/u01/app/oracle/oradata/ORCL/redo03.log' to '/oradata/ORCL/redo03.log';
alter database rename file '/u01/app/oracle/oradata/ORCL/redo02.log' to '/oradata/ORCL/redo02.log';
alter database rename file '/u01/app/oracle/oradata/ORCL/redo01.log' to '/oradata/ORCL/redo01.log';



SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/oradata/ORCL/redo03.log
/oradata/ORCL/redo02.log
/oradata/ORCL/redo01.log

8.启动数据库https://www.cndba.cn/hbhe0316/article/4860

https://www.cndba.cn/hbhe0316/article/4860
SQL>  alter database open resetlogs;

Database altered.

9.检查https://www.cndba.cn/hbhe0316/article/4860https://www.cndba.cn/hbhe0316/article/4860

SQL>  select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/oradata/orcl/system01.dbf
/oradata/orcl/sysaux01.dbf
/oradata/orcl/undotbs01.dbf
/oradata/orcl/pdbseed/system01.dbf
/oradata/orcl/pdbseed/sysaux01.dbf
/oradata/orcl/users01.dbf
/oradata/orcl/pdbseed/undotbs01.dbf
/oradata/orcl/hbhe/system01.dbf
/oradata/orcl/hbhe/sysaux01.dbf
/oradata/orcl/hbhe/undotbs01.dbf
/oradata/orcl/hbhe/users01.dbf

11 rows selected.

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/oradata/ORCL/control01.ctl
/oradata/ORCL/control02.ctl

10.重启创建临时表空间https://www.cndba.cn/hbhe0316/article/4860

SQL> create temporary tablespace temp1 tempfile '/oradata/orcl/temp01.dbf' size 1024m autoextend on;

Tablespace created.

SQL> alter database default temporary tablespace temp1;

Database altered.

SQL> drop tablespace temp including contents and datafiles;

Tablespace dropped.

SQL> alter user sys identified by wwwwww container=all;

User altered.

SQL> alter user system identified by wwwwww container=all;

User altered.


SQL> select count(*) from t1;

  COUNT(*)
----------
        36

版权声明:本文为博主原创文章,未经博主允许不得转载。

Linux,oracle

你可能感兴趣的:(oracle,linux,nodejs,slf4j,app)