Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of rman disk migration?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "what is the method of rman disk migration?". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

I migrate data files first

1 prepare

Insert a new disk and format it on mount

/ dev/sdc/

Mkfs.ext4 / dev/sdc/

Mkdir / home/oracle/cs

Mount / dev/sdc / home/oracle/cs

Vi / etc/fstab-permanent mount

Df-h

2 copy data files are moved to the new device cs

I) check the current library data file location first

SQL > select name from v$datafile

NAME

/ ooradata/test1/system01.dbf

/ ooradata/test1/sysaux01.dbf

/ ooradata/test1/undotbs01.dbf

/ ooradata/test1/users01.dbf

Ii) copy to the new path copy... To

Rman target/

Run {

Allocate channel c1 type disk

Allocate channel c2 type disk

Copy datafile'/ooradata/test1/system01.dbf'to'/home/oracle/cs/system01.dbf'

Copy datafile'/ooradata/test1/sysaux01.dbf'to'/home/oracle/cs/sysaux01.dbf'

Copy datafile'/ooradata/test1/undotbs01.dbf'to'/home/oracle/cs/undotbs01.dbf'

Copy datafile'/ooradata/test1/users01.dbf'to'/home/oracle/cs/users01.dbf'

}

Note: before copying, you can switch to alter system archive log current.

Iii) Verification

[oracle@jcy1 oradata] $cd / home/oracle/cs

[oracle@jcy1 cs] $ll

Total 1295400

-rw-r- 1 oracle dba 513810432 Feb 2 07:50 sysaux01.dbf

-rw-r- 1 oracle dba 775954432 Feb 2 07:50 system01.dbf

-rw-r- 1 oracle dba 31465472 Feb 2 07:50 undotbs01.dbf

-rw-r- 1 oracle dba 5251072 Feb 2 07:50 users01.dbf

II Migration Control File

1 check the location of the control file first

SQL > select name from v$controlfile

NAME

/ ooradata/test1/control01.ctl

/ u01/app/oracle/fast_recovery_area/test1/control02.ctl

2 copy to new location

RMAN > copy current controlfile to'/ home/oracle/cs/control01.ctl'

Note: there is no need to make the original location here, we will not change the 02.ctl. For the sake of security, the control files are usually placed on three different disks. We are only here for experiments.

I) Verification

[oracle@jcy1 oradata] $cd / home/oracle/cs

[oracle@jcy1 cs] $ls-l control01.ctl

-rw-r- 1 oracle dba 9748480 Feb 2 08:08 control01.ctl

Ii) because the control file has moved, you need to modify the control file location in the parameter file

SQL > create pfile='/home/oracle/cs/a.txt' from spfile

File created.

SQL >! vi / home/oracle/cs/a.txt

Modify the value control_files

* .control_files='/home/oracle/cs/control01.ctl','/u01/app/oracle/fast_recovery_area/test1/control02.ctl'

Close the library

SQL > shutdown immediate

Create spfile

SQL > create spfile from pfile='/home/oracle/cs/a.txt'

File created.

Start

SQL > startup nomount

SQL > alter database mount

Alter database mount

*

ERROR at line 1:

ORA-00214: control file

'/ u01Applink oracle version fastened recoveryAccording to Test1According to control02.ctl'Action724

Inconsistent with file'/ home/oracle/cs/control01.ctl' version 717

Solution: delete the second control file and add it later

SQL > create pfile ='/ home/oracle/cs/b.txt' from spfile;-- New b.txt file

File created.

SQL >! vi / home/oracle/cs/b.txt

Modify the value control_files

* .control_files='/home/oracle/cs/control01.ctl'

Close the library

SQL > shutdown immediate

Create psfile

SQL > create spfile from pfile='/home/oracle/cs/b.txt'

SQL > startup nomount

SQL > alter database mount

Normal

Iii) to see which control file is started

SQL > select name from v$controlfile

NAME

/ home/oracle/cs/control01.ctl

Note: if you still haven't changed it, you need to make it. I haven't encountered it here, ha.

RMAN > switch database to copy

3 recover data files

RMAN > recover database

III Migration Log File

1 View log file location

SQL > select member from v$logfile

MEMBER

/ ooradata/test1/redo03.log

/ ooradata/test1/redo02.log

/ ooradata/test1/redo01.log

2 copy to new location

SQL > alter database rename file'/ ooradata/test1/redo03.log' to'/ home/oracle/cs/redo03.log'

Database altered.

SQL > alter database rename file'/ ooradata/test1/redo02.log' to'/ home/oracle/cs/redo02.log'

Database altered.

SQL > alter database rename file'/ ooradata/test1/redo01.log' to'/ home/oracle/cs/redo01.log'

Database altered.

Verify it.

SQL > select member from v$logfile

MEMBER

/ home/oracle/cs/redo03.log

/ home/oracle/cs/redo02.log

/ home/oracle/cs/redo01.log

3 at this time, you can open the database. Be sure to migrate the data, control and log files before open.

SQL > alter database open RESETLOGS

Database altered.

IIII migrates temporary files

1 View temporary file location

SQL > select name from v$tempfile

NAME

/ ooradata/test1/temp01.dbf

2 change the temporary file location

I) idea: add a temporary file first, and then delete the previous one

SQL > alter tablespace temp add tempfile'/ home/oracle/cs/temp01.dbf' size 100m

Tablespace altered.

Ii) Delete

SQL > alter database tempfile'/ ooradata/test1/temp01.dbf' drop

Alter database tempfile'/ ooradata/test1/temp01.dbf' drop

*

ERROR at line 1:

ORA-25152: TEMPFILE cannot be dropped at this time

-- in use. You can delete it after reboot.

SQL > shutdown immediate

SQL > startup

SQL > alter database tempfile'/ ooradata/test1/temp01.dbf' drop

Database altered.

Iii) Verification

SQL > select name from v$tempfile

NAME

/ home/oracle/cs/temp01.dbf

This is the end of the introduction of "what is the method of rman disk migration?" Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report