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

How to use the method of rman copy to realize the migration ITPUB of bare device data files stored on storage

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Editor to share with you how to use rman copy method to achieve the storage of bare device data files on the migration ITPUB, I hope you will learn something after reading this article, let's discuss it together!

Using the method of rman copy to realize the migration ITPUB of bare device data files stored on storage

Background: sometimes in order to meet the needs of applications, some bare device data files have to be migrated to new storage or faster storage to meet the requirements of applications.

Here are the experiments to test the migration of control files, data files, temporary data files, and redo files to new storage methods

[oracle@single ~] $sqlplus "/ as sysdba"

SQL*Plus: Release 10.2.0.3.0-Production on Wednesday May 6 02:56:14 2009

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

SQL > select name from v$controlfile

NAMEITPUB

/ dev/raw/raw2

/ dev/raw/raw3

SQL > select name from v$datafile

NAME

/ dev/raw/raw7

/ dev/raw/raw11

/ dev/raw/raw10

/ dev/raw/raw9

SQL > select name from v$tempfile

NAME

/ dev/raw/raw8

SQL > select member from v$logfile

MEMBER

/ dev/raw/raw4

/ dev/raw/raw5

1. Build a lv of the same size as the original bare device. It is recommended that it be larger than the original lv and configure the permission attribute as oracle:dba.

1.1 previously stored control files newly stored control files

/ dev/raw/raw2 / dev/raw/raw22

/ dev/raw/raw3 / dev/raw/raw23

1.2 previously stored data files newly stored data files

/ dev/raw/raw7 / dev/raw/raw27

/ dev/raw/raw11 / dev/raw/raw31

/ dev/raw/raw10 / dev/raw/raw30

/ dev/raw/raw9 / dev/raw/raw29

1.3 previously stored log files newly stored log files

/ dev/raw/raw4 / dev/raw/raw24

/ dev/raw/raw5 / dev/raw/raw25

1.4 temporary files originally stored, temporary files newly stored

/ dev/raw/raw8 / dev/raw/raw28

two。 Migrate data files to new storage

2.1 Startup the database to mount status

SQL > startup mount

ORACLE instance started.

Total System Global Area 192937984 bytes

Fixed Size 1260840 bytes

Variable Size 67109592 bytes

Database Buffers 121634816 bytes

Redo Buffers 2932736 bytes

Database mounted.

SQL > exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0-Production

With the Partitioning, OLAP and Data Mining options

2.2 enter via rman target / mode

[oracle@single ~] $rman target /

Recovery Manager: Release 10.2.0.3.0-Production on Wednesday May 6 03:24:27 2009

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

Connected to target database: ORCL (DBID=1213870770, not open)

RMAN > copy datafile'/ dev/raw/raw7' to'/ dev/raw/raw27'

Starting backup at 06-May-09

Using target database control file instead of recovery catalog

Allocated channel: ORA_DISK_1I

Channel ORA_DISK_1: sid=156 devtype=DISK

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00001 name=/dev/raw/raw7

Output filename=/dev/raw/raw27 tag=TAG20090506T032607 recid=1 stamp=686114794

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35

Finished backup at 06-May-09

RMAN > copy datafile'/ dev/raw/raw9' to'/ dev/raw/raw29'

Starting backup at 06-May-09

Using channel ORA_DISK_1

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00004 name=/dev/raw/raw9

Output filename=/dev/raw/raw29 tag=TAG20090506T032716 recid=2 stamp=686114837

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:02

Finished backup at 06-May-09

RMAN > copy datafile'/ dev/raw/raw10' to'/ dev/raw/raw30'

Starting backup at 06-May-09

Using channel ORA_DISK_1

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00003 name=/dev/raw/raw10

Output filename=/dev/raw/raw30 tag=TAG20090506T032746 recid=3 stamp=686114875

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:16

Finished backup at 06-May-09

RMAN > copy datafile'/ dev/raw/raw11' to'/ dev/raw/raw31'

Starting backup at 06-May-09

Using channel ORA_DISK_1

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00002 name=/dev/raw/raw11

Output filename=/dev/raw/raw31 tag=TAG20090506T032822 recid=4 stamp=686114915

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15

Finished backup at 06-May-09

RMAN > 2. 3 enter sqlplus and change the file name to write to the control file

[oracle@single ~] $sqlplus "/ as sysdba"

SQL*Plus: Release 10.2.0.3.0-Production on Wednesday May 6 03:29:28 2009

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.3.0-Production

With the Partitioning, OLAP and Data Mining options

SQL > alter database rename file'/ dev/raw/raw7' to'/ dev/raw/raw27'

Database altered.

SQL > alter database rename file'/ dev/raw/raw9' to'/ dev/raw/raw29'

Database altered.

SQL > alter database rename file'/ dev/raw/raw10' to'/ dev/raw/raw30'

Database altered.

SQL > alter database rename file'/ dev/raw/raw11' to'/ dev/raw/raw31'

Database altered.

SQL > select name from v$datafile

NAME

/ dev/raw/raw27

/ dev/raw/raw31

/ dev/raw/raw30

/ dev/raw/raw29

SQL > alter database open

Database altered.

SQL >

Successfully migrated data files to new storage

3. Migrate control files to new storage

3.1. Backup control file

Startup mount

RMAN > backup current controlfile format'/ home/oracle/crontrol.bak'

Starting backup at 06-May-09

Using target database control file instead of recovery catalog

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid=156 devtype=DISK

Channel ORA_DISK_1: starting full datafile backupset

Channel ORA_DISK_1: specifying datafile (s) in backupset

Including current control file in backupset

Channel ORA_DISK_1: starting piece 1 at 06-May-09

Channel ORA_DISK_1: finished piece 1 at 06-May-09

Piece handle=/home/oracle/crontrol.bak tag=TAG20090506T033405 comment=NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05

Finished backup at 06-May-09

3.2. Close the library modification control file parameter file

Sqlplus "/ as sysdba"

Shutdown immediate

Create pfile from spfile

[oracle@single dbs] $vi initorcl.ora

# # #

Control_files= ("/ dev/raw/raw22", "/ dev/raw/raw23")

Point to the new parameter file lv and save

Create spfile from pfile

QL > startup nomount

ORACLE instance started.

Total System Global Area 192937984 bytes

Fixed Size 1260840 bytes

Variable Size 67109592 bytes

Database Buffers 121634816 bytes

Redo Buffers 2932736 bytes

SQL > show parameter cont

NAME TYPE

VALUE

-

Control_file_record_keep_time integer

# A2I4_6K F07

Control_files string

/ dev/raw/raw22, / dev/raw/raw23

Global_context_pool_size string

Restore the control file to the new storage, and mount and open the database in resetlogs mode

[oracle@single dbs] $rman target /

Recovery Manager: Release 10.2.0.3.0-Production on Wednesday May 6 03:38:47 2009

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

Connected to target database: orcl (not mounted)

RMAN > restore controlfile from'/ home/oracle/crontrol.bak'

Starting restore at 06-May-09

Using channel ORA_DISK_1

Channel ORA_DISK_1: restoring control file

Channel ORA_DISK_1: restore complete, elapsed time: 00:00:04

Output filename=/dev/raw/raw22

Output filename=/dev/raw/raw23

Finished restore at 06-May-09

RMAN > alter database mount

Database mounted

Released channel: ORA_DISK_1

RMAN > alter database open resetlogs

Database opened

[oracle@single dbs] $sqlplus "/ as sysdba"

SQL*Plus: Release 10.2.0.3.0-Production on Wednesday May 6 03:42:02 2009

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.3.0-Production

With the Partitioning, OLAP and Data Mining options

SQL > select name from v$controlfile

NAME

/ dev/raw/raw22

/ dev/raw/raw23

You can see that the migration of control files to the new storage has been successful

4. Migrate redo files to new storage

SQL > alter database add logfile'/ dev/raw/raw24' size 50m

Database altered.

SQL > alter database add logfile'/ dev/raw/raw25' size 50m

Database altered

QL > alter database drop logfile group 1

Database altered.

SQL > alter system switch logfile

System altered.

SQL > alter system switch logfile

System altered.

SQL > alter database drop logfile group 2

Database altered.

SQL > select member from v$logfile

MEMBER

/ dev/raw/raw24

/ dev/raw/raw25

SQL >

You can see that redo has been migrated to the new storage

5. Migrate temporary data files

SQL > create TEMPORARY TABLESPACE temp1 tempfile'/ oradata/temp01.dbf' size 50m

Tablespace created.

Alter database default temporary tablespace TEMP1

Drop TABLESPACE TEMP

CREATE TEMPORARY TABLESPACE TEMP TEMPFILE

'/ dev/raw/raw28' SIZE 500m AUTOEXTEND OFF

EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M

BLOCKSIZE 8K

SQL > alter database default temporary tablespace TEMP

Database altered.

SQL > drop tablespace temp1

Tablespace dropped.

SQL > select name from v$tempfile

NAME

/ dev/raw/raw28

SQL >

After reading this article, I believe you have a certain understanding of "how to use rman copy to achieve the migration of data files on bare devices ITPUB". If you want to know more about it, please follow the industry information channel and thank you for your reading!

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