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

Example Analysis of data fs to asm Migration in oracle

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

Share

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

Editor to share with you the oracle data fs to asm migration example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

(RedHat 10g Oracle environment)

1. Configure Oracle Cluster Synchronization (CSS)

To use ASM, you must first configure and start CSS

[root@redhat10g ~] # cd / u01/app/oracle/product/10.2.0/db_1/bin

[root@redhat10g bin] #. / localconfig add

2. Configure Automatic Storage Management (ASM) instance parameters

[oracle@aix201 ~] $vi / u01/app/oracle/product/10.2.0/db_1/dbs/init+ASM.ora

Instance_type='asm'

Asm_diskstring='/dev/mapper/asmvg-*'

Asm_diskgroups='DG1','RCY1'

Large_pool_size=12m

Background_dump_dest=/u01/app/oracle/product/10.2.0/db_1/admin/+ASM/bdump

Core_dump_dest=/u01/app/oracle/product/10.2.0/db_1/admin/+ASM/cdump

User_dump_dest=/u01/app/oracle/product/10.2.0/db_1/admin/+ASM/udump

3. Start the asm instance

[oracle@redhat10g ~] $export ORACLE_SID=+ASM

[oracle@redhat10g ~] $sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0-Production on Sun Jun 29 17:04:44 2014

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

Connected to an idle instance.

SQL > startup

ASM instance started

Total System Global Area 83886080 bytes

Fixed Size 1217836 bytes

Variable Size 57502420 bytes

ASM Cache 25165824 bytes

4. Create bare devices and modify users and permissions

1) add disk

2) Partition for disk:

[root@redhat10g ~] # fdisk / dev/sdb

Device Boot Start End Blocks Id System

/ dev/sdb1 1 2610 20964793 + 83 Linux

3) create a physical volume (pv):

[root@redhat10g ~] # pvcreate / dev/sdb1

/ dev/cdrom: open failed: Read-only file system

Attempt to close device'/ dev/cdrom' which is not open.

Physical volume "/ dev/sdb1" successfully created

View pv's information:

4) create a volume group:

[root@redhat10g ~] # vgcreate asmvg / dev/sdb1

5) create a logical volume lv:

[root@redhat10g] # lvcreate-n datalv1-L 5gb asmvg

/ dev/cdrom: open failed: Read-only file system

Logical volume "datalv1" created

[root@redhat10g] # lvcreate-n datalv2-L 5gb asmvg

/ dev/cdrom: open failed: Read-only file system

Logical volume "datalv2" created

[root@redhat10g] # lvcreate-n ocrdisklv1-L 4.5gb asmvg

/ dev/cdrom: open failed: Read-only file system

Logical volume "ocrdisklv1" created

[root@redhat10g] # lvcreate-n ocrdisklv2-L 4.5gb asmvg

/ dev/cdrom: open failed: Read-only file system

Logical volume "ocrdisklv2" created

6) bind bare devices:

[root@redhat10g ~] # raw/ dev/raw/raw1 / dev/mapper/asmvg-datalv1

/ dev/raw/raw1: bound to major 253, minor 2

[root@redhat10g ~] # raw/ dev/raw/raw2 / dev/mapper/asmvg-datalv2

/ dev/raw/raw2: bound to major 253, minor 3

[root@redhat10g ~] # raw/ dev/raw/raw3 / dev/mapper/asmvg-

Asmvg-datalv1 asmvg-datalv2 asmvg-ocrdisklv1 asmvg-ocrdisklv2

[root@redhat10g ~] # raw/ dev/raw/raw3 / dev/mapper/asmvg-ocrdisklv1

/ dev/raw/raw3: bound to major 253, minor 4

[root@redhat10g ~] # raw/ dev/raw/raw4 / dev/mapper/asmvg-ocrdisklv2

/ dev/raw/raw4: bound to major 253, minor 5

The server starts to automatically mount the bare device:

[root@redhat10g ~] # vi / etc/sysconfig/rawdevices

/ dev/raw/raw1 / dev/mapper/asmvg-datalv1

/ dev/raw/raw2 / dev/mapper/asmvg-datalv2

/ dev/raw/raw3 / dev/mapper/asmvg-ocrdisk1

/ dev/raw/raw4 / dev/mapper/asmvg-ocrdisk2

Restart the service to verify whether it can be mounted:

[root@redhat10g ~] # service rawdevices restart

Assigning devices:

/ dev/raw/raw1-- > / dev/mapper/asmvg-datalv1

/ dev/raw/raw1: bound to major 253, minor 2

/ dev/raw/raw2-- > / dev/mapper/asmvg-datalv2

/ dev/raw/raw2: bound to major 253, minor 3

/ dev/raw/raw3-- > / dev/mapper/asmvg-ocrdisklv1

/ dev/raw/raw3: bound to major 253, minor 4

/ dev/raw/raw4-- > / dev/mapper/asmvg-ocrdisklv2

/ dev/raw/raw4: bound to major 253, minor 5

7) modify device attributes:

[root@redhat10g raw] # chown-R oracle:oinstall / dev/raw/raw1

[root@redhat10g raw] # chown-R oracle:oinstall / dev/raw/raw2

[root@redhat10g raw] # chown-R oracle:oinstall / dev/raw/raw3

[root@redhat10g raw] # chown-R oracle:oinstall / dev/raw/raw4

[root@redhat10g] # chown-R oracle:oinstall / dev/mapper/asmvg-datalv1

[root@redhat10g] # chown-R oracle:oinstall / dev/mapper/asmvg-datalv2

[root@redhat10g] # chown-R oracle:oinstall / dev/mapper/asmvg-ocrdisklv1

[root@redhat10g] # chown-R oracle:oinstall / dev/mapper/asmvg-ocrdisklv2

5. Create an ASM disk group

In order to automatically mount disks and disk groups when ASM starts, add the following parameters to the initialization file:

Asm_diskstring='/dev/mapper/asmvg-*'

Asm_diskgroups='DG1','RCY1'

6. Modify parameters:

SQL > alter system set db_create_file_dest='+dg1' scope=spfile

System altered.

SQL > alter system set control_files='+dg1' scope=spfile

System altered.

7. Dump control files

RMAN > shutdown immediate

Using target database control file instead of recovery catalog

Database closed

Database dismounted

Oracle instance shut down

RMAN > startup nomount

Connected to target database (not started)

Oracle instance started

Total System Global Area 1258291200 bytes

Fixed Size 1219160 bytes

Variable Size 318768552 bytes

Database Buffers 922746880 bytes

Redo Buffers 15556608 bytes

RMAN > restore controlfile from'/ u01max App amp oracle control 01.ctl'

Starting restore at 29-JUN-14

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid=156 devtype=DISK

Channel ORA_DISK_1: copied control file copy

Output filename=+DG1/prod/controlfile/backup.256.851554395

Finished restore at 29-JUN-14

8. Dump the data file

RMAN > alter database mount

Database mounted

Released channel: ORA_DISK_1

RMAN > backup as copy database format'+ dg1'

Starting backup at 29-JUN-14

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid=156 devtype=DISK

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00001 name=/u01/app/oracle/oradata/prod/system01.dbf

Output filename=+DG1/prod/datafile/system.257.851554507 tag=TAG20140629T225507 recid=8 stamp=851554598

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

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00003 name=/u01/app/oracle/oradata/prod/sysaux01.dbf

Output filename=+DG1/prod/datafile/sysaux.258.851554603 tag=TAG20140629T225507 recid=9 stamp=851554652

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

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00005 name=/u01/app/oracle/oradata/prod/example01.dbf

Output filename=+DG1/prod/datafile/example.259.851554659 tag=TAG20140629T225507 recid=10 stamp=851554677

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

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00002 name=/u01/app/oracle/oradata/prod/undotbs01.dbf

Output filename=+DG1/prod/datafile/undotbs1.260.851554683 tag=TAG20140629T225507 recid=11 stamp=851554689

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

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00004 name=/u01/app/oracle/oradata/prod/users01.dbf

Output filename=+DG1/prod/datafile/users.261.851554691 tag=TAG20140629T225507 recid=12 stamp=851554691

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

Channel ORA_DISK_1: starting datafile copy

Copying current control file

Output filename=+DG1/prod/controlfile/backup.262.851554693 tag=TAG20140629T225507 recid=13 stamp=851554696

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

Channel ORA_DISK_1: starting full datafile backupset

Channel ORA_DISK_1: specifying datafile (s) in backupset

Including current SPFILE in backupset

Channel ORA_DISK_1: starting piece 1 at 29-JUN-14

Channel ORA_DISK_1: finished piece 1 at 29-JUN-14

Piece handle=+DG1/prod/backupset/2014_06_29/nnsnf0_tag20140629t225507_0.263.851554697 tag=TAG20140629T225507 comment=NONE

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

Finished backup at 29-JUN-14

RMAN > switch database to copy

Datafile 1 switched to datafile copy "+ DG1/prod/datafile/system.257.851554507"

Datafile 2 switched to datafile copy "+ DG1/prod/datafile/undotbs1.260.851554683"

Datafile 3 switched to datafile copy "+ DG1/prod/datafile/sysaux.258.851554603"

Datafile 4 switched to datafile copy "+ DG1/prod/datafile/users.261.851554691"

Datafile 5 switched to datafile copy "+ DG1/prod/datafile/example.259.851554659"

9. Restore the database

RMAN > recover database

Starting recover at 29-JUN-14

Using channel ORA_DISK_1

Starting media recovery

Media recovery complete, elapsed time: 00:00:00

Finished recover at 29-JUN-14

RMAN > alter database open

Database opened

10. Migrate temporary tablespaces

SQL > select name from v$datafile

NAME

+ DG1/prod/datafile/system.257.851554507

+ DG1/prod/datafile/undotbs1.260.851554683

+ DG1/prod/datafile/sysaux.258.851554603

+ DG1/prod/datafile/users.261.851554691

+ DG1/prod/datafile/example.259.851554659

SQL > select name from v$tempfile

NAME

/ u01/app/oracle/oradata/prod/temp01.dbf

/ u01/app/oracle/product/10.2.0/db_1/dbs/temp01.dbf

Error report:

SQL > alter tablespace temp drop tempfile'/ u01ActionApplicationoracleUniplicationproductUniplicate10.2.0OnDbsAction1According to dbsOntemp01.dbf'

Alter tablespace temp drop tempfile'/ u01qqappActionoracleUniverse productUniverse 10.2.0Uniplication1anddbsUniplettemp01.dbf'

*

ERROR at line 1:

ORA-00600: internal error code, arguments: [drop tempfile-2], [3], [7], [], []

[], [], []

11. Migrate online log groups:

SQL > alter database add logfile ('+ dg1','+rcy1') size 10m

Database altered.

SQL > alter database add logfile ('+ dg1','+rcy1') size 10m

Database altered.

SQL > alter database add logfile ('+ dg1','+rcy1') size 10m

Database altered.

SQL > select group#,member from v$logfile order by 1

GROUP# MEMBER

1/ u01/app/oracle/oradata/prod/redo01.log

2 / u01/app/oracle/oradata/prod/redo02.log

3 / u01/app/oracle/oradata/prod/redo03.log

4 + DG1/prod/onlinelog/group_4.265.851556583

4 + RCY1/prod/onlinelog/group_4.256.851556585

5 + DG1/prod/onlinelog/group_5.266.851556591

5 + RCY1/prod/onlinelog/group_5.257.851556595

6 + DG1/prod/onlinelog/group_6.267.851556599

6 + RCY1/prod/onlinelog/group_6.258.851556601

SQL > alter database drop logfile group 1

Database altered.

SQL > alter database drop logfile group 2

Alter database drop logfile group 2

*

ERROR at line 1:

ORA-01623: log 2 is current log for instance prod (thread 1)-cannot drop

ORA-00312: online log 2 thread 1:'/ u01Accord oradata thread redo02.log'

SQL > alter database drop logfile group 3

Database altered.

Since the second set of logs has not been archived, it cannot be deleted now, so switch logs to make log group 2 inactive.

SQL > alter system switch logfile

SQL > select group#,members,status from v$log

GROUP# MEMBERS STATUS

2 1 INACTIVE

4 2 CURRENT

5 2 INACTIVE

6 2 INACTIVE

SQL > alter database drop logfile group 2

Database altered.

12. Adjust recover area parameters

SQL > show parameter recover

NAME TYPE VALUE

-

Db_recovery_file_dest string / u01/app/oracle/flash_recovery

_ area

Db_recovery_file_dest_size big integer 2G

Recovery_parallelism integer 0

SQL > alter system set db_recovery_file_dest='+rcy1' scope=spfile

System altered.

SQL > alter system set db_recovery_file_dest_size=2g scope=spfile

System altered

The above is all the contents of the article "sample Analysis of data fs to asm Migration in oracle". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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