当前位置:网站首页>Migrate Oracle database from windows system to Linux Oracle RAC cluster environment (1) -- migrate data to node 1
Migrate Oracle database from windows system to Linux Oracle RAC cluster environment (1) -- migrate data to node 1
2022-06-25 02:24:00 【Rsda DBA_ WGX】
hold Oracle Database from Windows System migration to Linux Oracle Rac Cluster environment (1)—— Migrate data to nodes 1
Catalog
- hold Oracle Database from Windows System migration to Linux Oracle Rac Cluster environment (1)—— Migrate data to nodes 1
- One 、 Set the source database to be exported to non archive mode
- Two 、 stay Perform a database full backup on the source database
- 3、 ... and 、 Upload the backup file to oracle rac Clustered rac1 node
- Four 、 Modify parameter file
- 1、 Modify environment variables ( Set up ORACLE_SID=hisdb)
- 2、 Modify the contents of the parameter file
- 3、 Use pfile Start the instance to nomount
- 4、 Modify the... Of two nodes pfile file , Join in spfile File path
- 5、 according to pfile Parameter file generation spfile Parameter file , Save to asm disk
- 6、 Close instance , Use spfile Restart the instance to nomount
- 5、 ... and 、 Restore control files , Start the instance to mount
- 6、 ... and 、 Restore database
- 7、 ... and 、 Start database
- 8、 ... and 、 Modify log file information
- Nine 、 Upgrade data dictionary
- Ten 、 Restart instance
One 、 Set the source database to be exported to non archive mode
-- 1、 Stop storage
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
-- 2、 Start database to mount
SQL> startup mount
ORACLE instance started.
Total System Global Area 3357155328 bytes
Fixed Size 2180384 bytes
Variable Size 1828719328 bytes
Database Buffers 1509949440 bytes
Redo Buffers 16306176 bytes
Database mounted.
-- 3、 Change the archive mode of the database to non archive mode
SQL> alter database noarchivelog;
Database altered.
-- 4、 Open database
SQL> alter database open;
Database altered.
-- 5、 Look at the archive mode
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Current log sequence 3
Two 、 stay Perform a database full backup on the source database
1、 Create a to store backup files Catalog
F:\>md rman_bak
F:\>dir da*
Driver F The volume in the volume is New roll
The serial number of the volume is 544F-5332
F:\ The catalog of
14/06/2022 22:50 <DIR> rman_bak
0 File 0 byte
1 A catalog 234,147,532,800 Available byte
2、 View the database name and instance name of the source database
SQL> show parameter name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string hisdb
db_unique_name string hisdb
global_names boolean FALSE
instance_name string hisdb
lock_name_space string
log_file_name_convert string
service_names string hisdb
-- Both the database name and the instance name are hisdb
3、 Stop storage , Then start the database to mount
-- Stop storage
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
-- Start database to mount state
SQL> startup mount;
ORACLE instance started.
Total System Global Area 3357155328 bytes
Fixed Size 2180384 bytes
Variable Size 2332035808 bytes
Database Buffers 1006632960 bytes
Redo Buffers 16306176 bytes
Database mounted.
File created.
4、 Backup parameter file
SQL> create pfile='f:/rman_bak/pfile0614.ora' from spfile;
5、 Get into rman, Perform backup operations
C:\Users\Administrator>rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Jun 14 15:41:09 2022
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: HISDB (DBID=2002805648)
RMAN>
-- Set up rman Backup path and file format
-- configure channel device type disk format 'f:/rman_bak/%d_%I_%s_%p_%T.bkp';
RMAN> configure channel device type disk format 'f:/rman_bak/%d_%I_%s_%p_%T.bkp';
using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'f:/rman_bak/%d_%I_%s_%p_%T.bkp';
new RMAN configuration parameters are successfully stored
-- Backup database
-- backup as compressed backupset database;
RMAN> backup as compressed backupset database;
Starting backup at 14-JUN-22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=131 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=F:\APP\ORADATA\HISDB\SYSTEM01.DBF
input datafile file number=00002 name=F:\APP\ORADATA\HISDB\SYSAUX01.DBF
input datafile file number=00003 name=F:\APP\ORADATA\HISDB\UNDOTBS01.DBF
input datafile file number=00005 name=F:\APP\ORADATA\HISDB\TS001.DBF
input datafile file number=00006 name=F:\APP\ORADATA\HISDB\TS002.DBF
input datafile file number=00004 name=F:\APP\ORADATA\HISDB\USERS01.DBF
channel ORA_DISK_1: starting piece 1 at 14-JUN-22
channel ORA_DISK_1: finished piece 1 at 14-JUN-22
piece handle=F:\RMAN_BAK\HISDB_2002805648_10_1_20220614.BKP tag=TAG20220614T155620 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 14-JUN-22
channel ORA_DISK_1: finished piece 1 at 14-JUN-22
piece handle=F:\RMAN_BAK\HISDB_2002805648_11_1_20220614.BKP tag=TAG20220614T155620 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 14-JUN-22
3、 ... and 、 Upload the backup file to oracle rac Clustered rac1 node
[[email protected] data-bak]$ pwd
/home/oracle/data-bak
[[email protected] data-bak]$ ll
total 298580
-rw-r--r-- 1 oracle oinstall 304627712 Jun 14 15:56 HISDB_2002805648_10_1_20220614.BKP
-rw-r--r-- 1 oracle oinstall 1114112 Jun 14 15:56 HISDB_2002805648_11_1_20220614.BKP
-rw-r--r-- 1 oracle oinstall 902 Jun 14 23:26 pfile0614.ora
Four 、 Modify parameter file
1、 Modify environment variables ( Set up ORACLE_SID=hisdb)
# node 1
[[email protected] ~]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_OWNER=oracle
export ORACLE_SID=hisdb1 # ORACLE_SID=hisdb1
export ORACLE_TERM=vt100
export THREADS_FLAG=native
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
export EDITOR=vi
export SQLPATH=/home/oracle
export LANG=en_US
alias sqlplus='rlwrap sqlplus'
alias lsnrctl='rlwrap lsnrctl'
alias rman='rlwrap rman'
alias dgmgrl='rlwrap dgmgrl'
[[email protected] ~]$ source .bash_profile
# node 2
[[email protected] ~]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_OWNER=oracle
export ORACLE_SID=hisdb2 # ORACLE_SID=hisdb2
export ORACLE_TERM=vt100
export THREADS_FLAG=native
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
export EDITOR=vi
export SQLPATH=/home/oracle
export LANG=en_US
alias sqlplus='rlwrap sqlplus'
alias lsnrctl='rlwrap lsnrctl'
alias rman='rlwrap rman'
alias dgmgrl='rlwrap dgmgrl'
[[email protected] ~]$ source .bash_profile
2、 Modify the contents of the parameter file
[[email protected] data-bak]$ pwd
/home/oracle/data-bak
[[email protected] data-bak]$ ll
total 298580
-rw-r--r-- 1 oracle oinstall 304627712 Jun 14 15:56 HISDB_2002805648_10_1_20220614.BKP
-rw-r--r-- 1 oracle oinstall 1114112 Jun 14 15:56 HISDB_2002805648_11_1_20220614.BKP
-rw-r--r-- 1 oracle oinstall 902 Jun 14 23:26 pfile0614.ora
[[email protected] data-bak]$ vi pfile0614.ora
The contents of the parameter file are as follows :
hisdb.__db_cache_size=1241513984
hisdb.__java_pool_size=16777216
hisdb.__large_pool_size=16777216
hisdb.__oracle_base='f:\app'#ORACLE_BASE set from environment
hisdb.__pga_aggregate_target=1358954496
hisdb.__sga_target=2013265920
hisdb.__shared_io_pool_size=0
hisdb.__shared_pool_size=671088640
hisdb.__streams_pool_size=33554432
# ====== Delete the above =================================================================
#=====================================================================================
# Create directories on both nodes at the same time :/u01/app/oracle/admin/hisdb/adump
*.audit_file_dest='/u01/app/oracle/admin/hisdb/adump'
# Delete the next line
# *.audit_trail='db'
# Change the version number :11.2.0.4.0
*.compatible='11.2.0.4.0'
# *.control_files='f:\app\oradata\hisdb\control01.ctl','f:\app\flash_recovery_area\hisdb\control02.ctl'
*.control_files='+DATA/hisdb/controlfile/control01.ctl','+BAK/hisdb/controlfile/control02.ctl'
*.db_block_size=8192
# Delete the next line
# *.db_domain=''
*.db_name='hisdb'
# Create directories on both nodes at the same time :/u01/app/oracle/flash_recovery_area
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4102029312
# Modify the path
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=hisdbXDB)'
*.memory_target=838588928
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
The contents of the modified parameter file are as follows :
*.audit_file_dest='/u01/app/oracle/admin/hisdb/adump'
*.compatible='11.2.0.4.0'
*.control_files='+DATA/hisdb/controlfile/control01.ctl','+BAK/hisdb/controlfile/control02.ctl'
*.db_block_size=8192
*.db_name='hisdb'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4102029312
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=hisdbXDB)'
*.memory_target=638588928
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
3、 Use pfile Start the instance to nomount
-- startup nomount pfile='/home/oracle/data-bak/pfile0614.ora';
SQL> startup nomount pfile='/home/oracle/data-bak/pfile0614.ora';
ORACLE instance started.
Total System Global Area 638853120 bytes
Fixed Size 2255952 bytes
Variable Size 452985776 bytes
Database Buffers 176160768 bytes
Redo Buffers 7450624 bytes
4、 Modify the... Of two nodes pfile file , Join in spfile File path
# node 1
# vi /u01/app/oracle/product/11.2.0/db_1/dbs/inithisdb1.ora
[[email protected] data-bak]$ vi /u01/app/oracle/product/11.2.0/db_1/dbs/inithisdb1.ora
SPFILE='+DATA/hisdb/spfilehisdb.ora'
# node 2
# vi /u01/app/oracle/product/11.2.0/db_1/dbs/inithisdb2.ora
[[email protected] data-bak]$ vi /u01/app/oracle/product/11.2.0/db_1/dbs/inithisdb2.ora
SPFILE='+DATA/hisdb/spfilehisdb.ora'
5、 according to pfile Parameter file generation spfile Parameter file , Save to asm disk
-- create spfile='+DATA/hisdb/spfilehisdb.ora' from pfile;
SQL> create spfile='+DATA/hisdb/spfilehisdb.ora' from pfile='/home/oracle/data-bak/pfile0614.ora';
File created.
6、 Close instance , Use spfile Restart the instance to nomount
-- Close the database
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
-- Start the instance to get mount
SQL> startup nomount
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2255832 bytes
Variable Size 297796648 bytes
Database Buffers 318767104 bytes
Redo Buffers 7507968 bytes
5、 ... and 、 Restore control files , Start the instance to mount
-- Restore control files
[oracle@rac1 data-bak]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jun 16 16:49:19 2022
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: HISDB (not mounted)
-- Restore control files
RMAN> restore controlfile from '/home/oracle/data-bak/HISDB_2002805648_11_1_20220614.BKP';
Starting restore at 16-JUN-22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=139 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:16
output file name=+DATA/hisdb/controlfile/control01.ctl
output file name=+BAK/hisdb/controlfile/control02.ctl
Finished restore at 16-JUN-22
-- Start the instance to mount
SQL> alter database mount;
Database altered.
View the data file and temporary file information in the control file :
RMAN> report schema;
released channel: ORA_DISK_1
Starting implicit crosscheck backup at 16-JUN-22
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=139 device type=DISK
Crosschecked 10 objects
Finished implicit crosscheck backup at 16-JUN-22
Starting implicit crosscheck copy at 16-JUN-22
using channel ORA_DISK_1
Finished implicit crosscheck copy at 16-JUN-22
searching for all files in the recovery area
cataloging files...
no files cataloged
RMAN-06139: WARNING: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name HISDB
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 0 SYSTEM *** F:\APP\ORADATA\HISDB\SYSTEM01.DBF
2 0 SYSAUX *** F:\APP\ORADATA\HISDB\SYSAUX01.DBF
3 0 UNDOTBS1 *** F:\APP\ORADATA\HISDB\UNDOTBS01.DBF
4 0 USERS *** F:\APP\ORADATA\HISDB\USERS01.DBF
5 0 TS001 *** F:\APP\ORADATA\HISDB\TS001.DBF
6 0 TS001 *** F:\APP\ORADATA\HISDB\TS002.DBF
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 20 TEMP 32767 F:\APP\ORADATA\HISDB\TEMP01.DBF
6、 ... and 、 Restore database
1、 Check the backup file
CROSSCHECK The command is used to verify the backup file , In order to ensure that RMAN The database is synchronized with the backup file . When the command is executed , If RMAN The state of the database record does not match the actual backup file , The status in the database will be updated to make it consistent with the actual backup file status ; If the backup file is in expired state , This means that the backup has expired , You can delete .
RMAN> crosscheck backup;
using channel ORA_DISK_1
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=D:\BAK_20211202\HISDB_20211202_030FNB1I_1_1_1.BAK RECID=1 STAMP=1090235448
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=D:\BAK_20211202\HISDB_20211202_040FNB1O_1_1_1.BAK RECID=2 STAMP=1090235452
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=D:\BAK_20211202\HISDB_20211202_020FNB1I_1_1_1.BAK RECID=3 STAMP=1090235442
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=D:\BAK_20211202\HISDB_20211202_050FNB1R_1_1_1.BAK RECID=4 STAMP=1090235453
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=D:\BAK_20211202\HISDB_20211202_070FNB1T_1_1_1.BAK RECID=5 STAMP=1090235455
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=D:\BAK_20211202\HISDB_20211202_080FNB1V_1_1_1.BAK RECID=6 STAMP=1090235456
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=D:\BAK_20211202\HISDB_20211202_060FNB1T_1_1_1.BAK RECID=7 STAMP=1090235456
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=D:\BAK_20211202\HISDB_20211202_010FNB1H_1_1_1.BAK RECID=8 STAMP=1090235442
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=D:\BAK_20211202\CTL_HISDB_20211202_1090235463_9_1 RECID=9 STAMP=1090235465
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=F:\RMAN_BAK\HISDB_2002805648_10_1_20220614.BKP RECID=10 STAMP=1107359781
Crosschecked 10 objects
2、 Delete invalid backup files
RMAN> delete expired backup;
using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
1 1 1 1 EXPIRED DISK D:\BAK_20211202\HISDB_20211202_030FNB1I_1_1_1.BAK
2 2 1 1 EXPIRED DISK D:\BAK_20211202\HISDB_20211202_040FNB1O_1_1_1.BAK
3 3 1 1 EXPIRED DISK D:\BAK_20211202\HISDB_20211202_020FNB1I_1_1_1.BAK
4 4 1 1 EXPIRED DISK D:\BAK_20211202\HISDB_20211202_050FNB1R_1_1_1.BAK
5 5 1 1 EXPIRED DISK D:\BAK_20211202\HISDB_20211202_070FNB1T_1_1_1.BAK
6 6 1 1 EXPIRED DISK D:\BAK_20211202\HISDB_20211202_080FNB1V_1_1_1.BAK
7 7 1 1 EXPIRED DISK D:\BAK_20211202\HISDB_20211202_060FNB1T_1_1_1.BAK
8 8 1 1 EXPIRED DISK D:\BAK_20211202\HISDB_20211202_010FNB1H_1_1_1.BAK
9 9 1 1 EXPIRED DISK D:\BAK_20211202\CTL_HISDB_20211202_1090235463_9_1
10 10 1 1 EXPIRED DISK F:\RMAN_BAK\HISDB_2002805648_10_1_20220614.BKP
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=D:\BAK_20211202\HISDB_20211202_030FNB1I_1_1_1.BAK RECID=1 STAMP=1090235448
deleted backup piece
backup piece handle=D:\BAK_20211202\HISDB_20211202_040FNB1O_1_1_1.BAK RECID=2 STAMP=1090235452
deleted backup piece
backup piece handle=D:\BAK_20211202\HISDB_20211202_020FNB1I_1_1_1.BAK RECID=3 STAMP=1090235442
deleted backup piece
backup piece handle=D:\BAK_20211202\HISDB_20211202_050FNB1R_1_1_1.BAK RECID=4 STAMP=1090235453
deleted backup piece
backup piece handle=D:\BAK_20211202\HISDB_20211202_070FNB1T_1_1_1.BAK RECID=5 STAMP=1090235455
deleted backup piece
backup piece handle=D:\BAK_20211202\HISDB_20211202_080FNB1V_1_1_1.BAK RECID=6 STAMP=1090235456
deleted backup piece
backup piece handle=D:\BAK_20211202\HISDB_20211202_060FNB1T_1_1_1.BAK RECID=7 STAMP=1090235456
deleted backup piece
backup piece handle=D:\BAK_20211202\HISDB_20211202_010FNB1H_1_1_1.BAK RECID=8 STAMP=1090235442
deleted backup piece
backup piece handle=D:\BAK_20211202\CTL_HISDB_20211202_1090235463_9_1 RECID=9 STAMP=1090235465
deleted backup piece
backup piece handle=F:\RMAN_BAK\HISDB_2002805648_10_1_20220614.BKP RECID=10 STAMP=1107359781
Deleted 10 EXPIRED objects
3、 Update backup file
--catalog start with '/home/oracle/data-bak/'; -- Note the contents here
RMAN> catalog start with '/home/oracle/data-bak/';
searching for all files that match the pattern /home/oracle/data-bak/
List of Files Unknown to the Database
=====================================
File Name: /home/oracle/data-bak/HISDB_2002805648_10_1_20220614.BKP
File Name: /home/oracle/data-bak/HISDB_2002805648_11_1_20220614.BKP
File Name: /home/oracle/data-bak/pfile0614.ora
File Name: /home/oracle/data-bak/pfilehisdb.ora
Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /home/oracle/data-bak/HISDB_2002805648_10_1_20220614.BKP
File Name: /home/oracle/data-bak/HISDB_2002805648_11_1_20220614.BKP
List of Files Which Where Not Cataloged
=======================================
File Name: /home/oracle/data-bak/pfile0614.ora
RMAN-07517: Reason: The file header is corrupted
File Name: /home/oracle/data-bak/pfilehisdb.ora
RMAN-07517: Reason: The file header is corrupted
4、 View Backup slice information
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11 Full 290.51M DISK 00:00:00 14-JUN-22
BP Key: 11 Status: AVAILABLE Compressed: YES Tag: TAG20220614T155620
Piece Name: /home/oracle/data-bak/HISDB_2002805648_10_1_20220614.BKP
List of Datafiles in backup set 11
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 8146403 14-JUN-22 F:\APP\ORADATA\HISDB\SYSTEM01.DBF
2 Full 8146403 14-JUN-22 F:\APP\ORADATA\HISDB\SYSAUX01.DBF
3 Full 8146403 14-JUN-22 F:\APP\ORADATA\HISDB\UNDOTBS01.DBF
4 Full 8146403 14-JUN-22 F:\APP\ORADATA\HISDB\USERS01.DBF
5 Full 8146403 14-JUN-22 F:\APP\ORADATA\HISDB\TS001.DBF
6 Full 8146403 14-JUN-22 F:\APP\ORADATA\HISDB\TS002.DBF
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
12 Full 1.05M DISK 00:00:00 14-JUN-22
BP Key: 12 Status: AVAILABLE Compressed: YES Tag: TAG20220614T155620
Piece Name: /home/oracle/data-bak/HISDB_2002805648_11_1_20220614.BKP
SPFILE Included: Modification time: 14-JUN-22
SPFILE db_unique_name: HISDB
Control File Included: Ckp SCN: 8146403 Ckp time: 14-JUN-22
5、 Recover database
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
run{
set newname for datafile 1 to '+data/';
set newname for datafile 2 to '+data/';
set newname for datafile 3 to '+data/';
set newname for datafile 4 to '+data/';
set newname for datafile 5 to '+data/';
set newname for datafile 6 to '+data/';
set newname for tempfile 1 to '+data/';
restore database;
switch datafile all;
switch tempfile all;
}
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
RMAN>
run{
set newname for datafile 1 to '+data/';
set newname for datafile 2 to '+data/';
set newname for datafile 3 to '+data/';
set newname for datafile 4 to '+data/';
set newname for datafile 5 to '+data/';
set newname for tempfile 1 to '+data/';
restore database;
switch datafile all;
switch tempfile all;
11> }
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 16-JUN-22
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +data/
channel ORA_DISK_1: restoring datafile 00002 to +data/
channel ORA_DISK_1: restoring datafile 00003 to +data/
channel ORA_DISK_1: restoring datafile 00004 to +data/
channel ORA_DISK_1: restoring datafile 00005 to +data/
channel ORA_DISK_1: restoring datafile 00006 to F:\APP\ORADATA\HISDB\TS002.DBF
channel ORA_DISK_1: reading from backup piece /home/oracle/data-bak/HISDB_2002805648_10_1_20220614.BKP
channel ORA_DISK_1: piece handle=/home/oracle/data-bak/HISDB_2002805648_10_1_20220614.BKP tag=TAG20220614T155620
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:55
Finished restore at 16-JUN-22
datafile 1 switched to datafile copy
input datafile copy RECID=7 STAMP=1107536313 file name=+DATA/hisdb/datafile/system.281.1107536257
datafile 2 switched to datafile copy
input datafile copy RECID=8 STAMP=1107536313 file name=+DATA/hisdb/datafile/sysaux.282.1107536257
datafile 3 switched to datafile copy
input datafile copy RECID=9 STAMP=1107536314 file name=+DATA/hisdb/datafile/undotbs1.283.1107536257
datafile 4 switched to datafile copy
input datafile copy RECID=10 STAMP=1107536315 file name=+DATA/hisdb/datafile/users.285.1107536259
datafile 5 switched to datafile copy
input datafile copy RECID=11 STAMP=1107536315 file name=+DATA/hisdb/datafile/ts001.284.1107536259
renamed tempfile 1 to +data/ in control file
7、 ... and 、 Start database
SQL> alter database open resetlogs upgrade;
Database altered.
Compile invalid object :
SQL> @?/rdbms/admin/utlrp.sql
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN 2022-06-15 21:32:50
DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC> objects in the database. Recompilation time is proportional to the
DOC> number of invalid objects in the database, so this command may take
DOC> a long time to execute on a database with a large number of invalid
DOC> objects.
DOC>
DOC> Use the following queries to track recompilation progress:
DOC>
DOC> 1. Query returning the number of invalid objects remaining. This
DOC> number should decrease with time.
DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC> 2. Query returning the number of objects compiled so far. This number
DOC> should increase with time.
DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC> This script automatically chooses serial or parallel recompilation
DOC> based on the number of CPUs available (parameter cpu_count) multiplied
DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC> On RAC, this number is added across all RAC nodes.
DOC>
DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC> recompilation. Jobs are created without instance affinity so that they
DOC> can migrate across RAC nodes. Use the following queries to verify
DOC> whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC> 1. Query showing jobs created by UTL_RECOMP
DOC> SELECT job_name FROM dba_scheduler_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC> 2. Query showing UTL_RECOMP jobs that are running
DOC> SELECT job_name FROM dba_scheduler_running_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#
DECLARE
*
ERROR at line 1:
ORA-04063: package body "SYS.DBMS_SQLTUNE" has errors
ORA-06508: PL/SQL: could not find program unit being called: "SYS.DBMS_SQLTUNE"
ORA-06512: at "SYS.UTL_RECOMP", line 783
ORA-06512: at line 4
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END 2022-06-15 21:32:59
DOC> The following query reports the number of objects that have compiled
DOC> with errors.
DOC>
DOC> If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#
OBJECTS WITH ERRORS
-------------------
0
DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#
ERRORS DURING RECOMPILATION
---------------------------
0
Function created.
PL/SQL procedure successfully completed.
Function dropped.
PL/SQL procedure successfully completed.
8、 ... and 、 Modify log file information
1、 View log file information
SQL> col member for a40
SQL> select GROUP#, STATUS, TYPE, MEMBER from v$logfile;
GROUP# STATUS TYPE MEMBER
---------- ------- ------- ----------------------------------------
3 ONLINE F:\APP\ORADATA\HISDB\REDO03.LOG
2 ONLINE F:\APP\ORADATA\HISDB\REDO02.LOG
1 ONLINE F:\APP\ORADATA\HISDB\REDO01.LOG
2、 Add log groups and log files
-- Is used to specify the Oracle The default path for the database server to create data files
SQL> alter system set db_create_file_dest='+DATA';
System altered.
-- Create directory in advance :/usr/local/oradata/hisdb_bak/
alter database add logfile group 5 '+data/hisdb/onlinelog/redo05a.log' size 50m;
alter database add logfile group 6 '+data/hisdb/onlinelog/redo06a.log' size 50m;
alter database add logfile group 7 '+data/hisdb/onlinelog/redo07a.log' size 50m;
3、 View log file information
SQL> select GROUP#, STATUS, TYPE, MEMBER from v$logfile;
GROUP# STATUS TYPE MEMBER
---------- ------- ------- ----------------------------------------
3 ONLINE F:\APP\ORADATA\HISDB\REDO03.LOG
2 ONLINE F:\APP\ORADATA\HISDB\REDO02.LOG
1 ONLINE F:\APP\ORADATA\HISDB\REDO01.LOG
5 ONLINE /usr/local/oradata/hisdb/redo05a.log
6 ONLINE /usr/local/oradata/hisdb/redo06a.log
7 ONLINE /usr/local/oradata/hisdb/redo07a.log
5 INVALID ONLINE /usr/local/oradata/hisdb_bak/redo05b.log
6 INVALID ONLINE /usr/local/oradata/hisdb_bak/redo06b.log
7 INVALID ONLINE /usr/local/oradata/hisdb_bak/redo07b.log
9 rows selected.
SQL> select GROUP#,SEQUENCE#,BYTES,MEMBERS,STATUS from v$log;
GROUP# SEQUENCE# BYTES MEMBERS STATUS
---------- ---------- ---------- ---------- ----------------
1 340 52428800 1 INACTIVE
2 341 52428800 1 INACTIVE
7 0 314572800 2 UNUSED
5 0 314572800 2 UNUSED
6 0 314572800 2 UNUSED
3 342 52428800 1 CURRENT
6 rows selected.
4、 Delete invalid log groups
(1) Switch logs
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> select GROUP#,SEQUENCE#,BYTES,MEMBERS,STATUS from v$log;
GROUP# SEQUENCE# BYTES MEMBERS STATUS
---------- ---------- ---------- ---------- ----------------
1 1 52428800 1 INACTIVE
2 2 52428800 1 ACTIVE
3 3 52428800 1 ACTIVE
5 4 314572800 2 CURRENT -- The current log group is 4
6 0 314572800 2 UNUSED
7 0 314572800 2 UNUSED
6 rows selected.
(2) Check points
SQL> alter system checkpoint;
System altered.
SQL> select GROUP#,SEQUENCE#,BYTES,MEMBERS,STATUS from v$log;
GROUP# SEQUENCE# BYTES MEMBERS STATUS
---------- ---------- ---------- ---------- ----------------
1 1 52428800 1 INACTIVE -- Log group 1 Become inactive (INACTIVE)
2 2 52428800 1 INACTIVE -- Log group 2 Become inactive (INACTIVE)
3 3 52428800 1 INACTIVE -- Log group 3 Become inactive (INACTIVE)
5 4 314572800 2 CURRENT
6 0 314572800 2 UNUSED
7 0 314572800 2 UNUSED
6 rows selected.
(3) Delete log group :1、2、3
SQL> alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;
Database altered.
(4) View log group information
SQL> select GROUP#,SEQUENCE#,BYTES,MEMBERS,STATUS from v$log;
GROUP# SEQUENCE# BYTES MEMBERS STATUS
---------- ---------- ---------- ---------- ----------------
5 4 314572800 2 CURRENT
6 0 314572800 2 UNUSED
7 0 314572800 2 UNUSED
SQL> select GROUP#, STATUS, TYPE, MEMBER from v$logfile;
GROUP# STATUS TYPE MEMBER
---------- ------- ------- ----------------------------------------
5 ONLINE /usr/local/oradata/hisdb/redo05a.log
6 ONLINE /usr/local/oradata/hisdb/redo06a.log
7 ONLINE /usr/local/oradata/hisdb/redo07a.log
5 ONLINE /usr/local/oradata/hisdb_bak/redo05b.log
6 ONLINE /usr/local/oradata/hisdb_bak/redo06b.log
7 ONLINE /usr/local/oradata/hisdb_bak/redo07b.log
6 rows selected.
Nine 、 Upgrade data dictionary
1、 adopt startup upgrade Boot instance
-- Stop storage
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
-- Start database
SQL> startup upgrade;
ORACLE instance started.
Total System Global Area 659730432 bytes
Fixed Size 2256152 bytes
Variable Size 444596968 bytes
Database Buffers 209715200 bytes
Redo Buffers 3162112 bytes
Database mounted.
Database opened.
2、 Upgrade data dictionary
SQL> @$ORACLE_HOME/rdbms/admin/catupgrd.sql
Ten 、 Restart instance
-- Stop storage
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
-- Boot instance
SQL> startup
ORACLE instance started.
Total System Global Area 659730432 bytes
Fixed Size 2256152 bytes
Variable Size 457179880 bytes
Database Buffers 192937984 bytes
Redo Buffers 7356416 bytes
Database mounted.
Database opened.
Compile the invalid application object again :
@?/rdbms/admin/utlrp.sql
边栏推荐
- tmux 如何自定义背景颜色 | How does the tmux color palette work?
- 算力服务网络:一场多元融合的系统革命
- Once beego failed to find bee after passing the go get command Exe's pit
- Android物联网应用程序开发(智慧园区)—— 设置传感器阈值对话框界面
- 元宇宙的生态圈
- MOS tube related knowledge
- What are the reasons for the abnormal playback of the online channel of the channel accessed by easycvr national standard protocol?
- Cusdis - lightweight, privacy first open source comment system | chain of the city
- Squid 代理服务器之 ACL 访问控制
- What is the reason for the disconnection of video playback due to the EHOME protocol access of easycvr platform?
猜你喜欢
文件系统 -- 磁盘基础知识和FAT32文件系统详细介绍
qt打包exe文件,解决“无法定位程序输入点_ZdaPvj于动态链接库Qt5Cored.dll”
Experience of epidemic prevention and control, home office and online teaching | community essay solicitation
DDD concept is complex and difficult to understand. How to design code implementation model in practice?
业务与技术双向结合构建银行数据安全管理体系
会自动化—10K,能做自动化—20K,你搞懂自动化测试没有?
【FPGA】串口以命令控制温度采集
When they are in private, they have a sense of propriety
After reciting the eight part essay, I won the hemp in June
【Proteus仿真】Arduino UNO+数码管显示4x4键盘矩阵按键
随机推荐
调用系统函数安全方案
mysql命令备份
当他们在私域里,掌握了分寸感
[mobile terminal] design size of mobile phone interface
Talking about the advantages of flying book in development work | community essay solicitation
Is the compass reliable? Is it safe to open a securities account?
centos7.3修改mysql默认密码_详解Centos7 修改mysql指定用户的密码
华泰证券如何开户能做到万分之一?证券开户安全可靠吗
How to quickly familiarize yourself with the code when you join a new company?
对进程内存的实践和思考
EasyCVR平台EHOME协议接入,视频播放出现断流是什么原因?
Build and train your own dataset for pig face recognition
LINQ query (3)
消息称一加将很快更新TWS耳塞、智能手表和手环产品线
字符串数组转换为list集合
E - Average and Median(二分)
入坑机器学习:一,绪论
Squid 代理服务器之 ACL 访问控制
Post competition summary of kaggle patent matching competition
jwt