oracle 11g R2 单实例 ASM 数据库数据磁盘组迁移
oracle 11g R2 单实例 ASM 数据库数据磁盘组迁移 在使用ASM作为数据库存储的时候,可能往往我们会因为某些原因,会考虑将数据的存储数据迁移到一个新的磁盘组。 例如:创建数据库的时候,数据存储在一个External redundancy 的磁盘组,没有冗余镜像。后期我
oracle 11g R2 单实例 ASM 数据库数据磁盘组迁移
在使用ASM作为数据库存储的时候,可能往往我们会因为某些原因,会考虑将数据的存储数据迁移到一个新的磁盘组。
例如:创建数据库的时候,数据存储在一个External redundancy 的磁盘组,没有冗余镜像。后期我们会考虑将数据库数据迁移到一个Normal redundancy 或者 High redundancy的磁盘组。
测试环境:
主机环境
SQL> host lsb_release -a
LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: EnterpriseEnterpriseServer
Description: Enterprise Linux Enterprise Linux Server release 5.7 (Carthage)
Release: 5.7
Codename: Carthage
数据库版本:
SQL> select instance_name,version from v$instance;
INSTANCE_NAME VERSION
---------------- -----------------
ORCL 11.2.0.3.0
##单实例
ASM版本
SQL> select instance_name,version from v$instance;
INSTANCE_NAME VERSION
---------------- -----------------
+ASM 11.2.0.3.0
ASM磁盘组共三个
SQL> select name from v$asm_diskgroup;
NAME
------------------------------
BACKUP
SYSTEMDG
DATA
目前数据数据存储于 SYSTEMDG ,包括(数据文件,临时文件,undo文件,redo文件、控制文件、参数文件) 本测试将数据迁移至DATA磁盘组,BACKUP磁盘组为备份dest。环境交代完毕!
需要迁移的文件:数据文件,临时文件,undo文件,redo文件、控制文件、参数文件
迁移前,先记下数据库的DBID
开始迁移
#首先,consistent 关闭数据库 SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. #将数据库启动至mount状态 SQL> startup mount; ORACLE instance started. Total System Global Area 542814208 bytes Fixed Size 2230152 bytes Variable Size 180357240 bytes Database Buffers 352321536 bytes Redo Buffers 7905280 bytes Database mounted. #启动rman工具,将数据库镜像备份至DATA磁盘组 RMAN> backup as copy database format '+DATA'; Starting backup at 28-OCT-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=137 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=16 device type=DISK channel ORA_DISK_1: starting datafile copy input datafile file number=00001 name=+SYSTEMDG/orcl/datafile/system.261.829928875 channel ORA_DISK_2: starting datafile copy input datafile file number=00002 name=+SYSTEMDG/orcl/datafile/sysaux.262.829928875 output file name=+DATA/orcl/datafile/system.257.830041439 tag=TAG20131028T230354 RECID=23 STAMP=830041580 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:25 channel ORA_DISK_1: starting datafile copy input datafile file number=00003 name=+SYSTEMDG/orcl/datafile/undotbs1.263.829929061 output file name=+DATA/orcl/datafile/sysaux.256.830041437 tag=TAG20131028T230354 RECID=22 STAMP=830041580 channel ORA_DISK_2: datafile copy complete, elapsed time: 00:02:26 channel ORA_DISK_2: starting datafile copy input datafile file number=00005 name=+SYSTEMDG/orcl/datafile/users01.264.829929061 output file name=+DATA/orcl/datafile/undotbs1.258.830041581 tag=TAG20131028T230354 RECID=25 STAMP=830041611 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35 channel ORA_DISK_1: starting datafile copy input datafile file number=00004 name=+SYSTEMDG/orcl/datafile/users.265.829929107 output file name=+DATA/orcl/datafile/users01.259.830041581 tag=TAG20131028T230354 RECID=24 STAMP=830041611 channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:35 output file name=+DATA/orcl/datafile/users.260.830041617 tag=TAG20131028T230354 RECID=26 STAMP=830041617 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 28-OCT-13 Starting Control File and SPFILE Autobackup at 28-OCT-13 piece handle=+BACKUP/orcl/autobackup/2013_10_28/s_830041354.262.830041621 comment=NONE Finished Control File and SPFILE Autobackup at 28-OCT-13 #完成copy #查看当前控制文件value,并修改为希望的值 SQL> show parameter control_files NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_files string +SYSTEMDG/orcl/control01.ctl, +BACKUP/orcl/controlfile/curre nt.256.829519259 SQL> alter system set control_files='+DATA','+BACKUP/orcl/controlfile/current.256.829519259' scope=spfile; System altered. #关闭数据库,让修改的control_files参数生效 SQL> shutdown immediate; ORA-01109: database not open Database dismounted. ORACLE instance shut down. #将数据库启动至nomount阶段 SQL> startup nomount; ORACLE instance started. Total System Global Area 542814208 bytes Fixed Size 2230152 bytes Variable Size 180357240 bytes Database Buffers 352321536 bytes Redo Buffers 7905280 bytes #打开RMAN工具,通过设置dbid的方式,恢复控制文件,此时,数据库会根据control_files设置的值,将控制文件恢复到指定的位置。 [oracle@linusfay-up ~]$ rman target / Recovery Manager: Release 11.2.0.3.0 - Production on Mon Oct 28 23:56:54 2013 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (not mounted) RMAN> set dbid=1357299984 executing command: SET DBID #从自动备份中恢复控制文件 RMAN> restore controlfile from autobackup; Starting restore at 28-OCT-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=136 device type=DISK recovery area destination: +BACKUP database name (or database unique name) used for search: ORCL channel ORA_DISK_1: AUTOBACKUP +backup/ORCL/AUTOBACKUP/2013_10_28/s_830041354.262.830041621 found in the recovery area channel ORA_DISK_1: looking for AUTOBACKUP on day: 20131028 channel ORA_DISK_1: restoring control file from AUTOBACKUP +backup/ORCL/AUTOBACKUP/2013_10_28/s_830041354.262.830041621 channel ORA_DISK_1: control file restore from AUTOBACKUP complete output file name=+DATA/orcl/controlfile/current.261.830042181 output file name=+BACKUP/orcl/controlfile/current.256.829519259 Finished restore at 28-OCT-13 #控制文件恢复成功,将数据库启动至mount阶段 RMAN> alter database mount; #查看之前备份的数据库镜像 RMAN> list copy of database; List of Datafile Copies ======================= Key File S Completion Time Ckp SCN Ckp Time ------- ---- - --------------- ---------- --------------- 23 1 A 28-OCT-13 1087234 28-OCT-13 Name: +DATA/orcl/datafile/system.257.830041439 Tag: TAG20131028T230354 22 2 A 28-OCT-13 1087234 28-OCT-13 Name: +DATA/orcl/datafile/sysaux.256.830041437 Tag: TAG20131028T230354 25 3 A 28-OCT-13 1087234 28-OCT-13 Name: +DATA/orcl/datafile/undotbs1.258.830041581 Tag: TAG20131028T230354 26 4 A 28-OCT-13 1087234 28-OCT-13 Name: +DATA/orcl/datafile/users.260.830041617 Tag: TAG20131028T230354 24 5 A 28-OCT-13 1087234 28-OCT-13 Name: +DATA/orcl/datafile/users01.259.830041581 Tag: TAG20131028T230354 database mounted released channel: ORA_DISK_1 #将数据库switch至database copy RMAN> switch database to copy; Starting implicit crosscheck backup at 28-OCT-13 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=136 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=16 device type=DISK Crosschecked 5 objects Finished implicit crosscheck backup at 28-OCT-13 Starting implicit crosscheck copy at 28-OCT-13 using channel ORA_DISK_1 using channel ORA_DISK_2 Crosschecked 5 objects Finished implicit crosscheck copy at 28-OCT-13 searching for all files in the recovery area cataloging files... cataloging done List of Cataloged Files ======================= File Name: +backup/ORCL/AUTOBACKUP/2013_10_28/s_830041354.262.830041621 File Name: +backup/ORCL/AUTOBACKUP/2013_10_27/s_829931410.271.829931413 File Name: +backup/ORCL/AUTOBACKUP/2013_10_27/s_829920770.278.829920963 File Name: +backup/ORCL/AUTOBACKUP/2013_10_27/s_829920770.276.829921283 datafile 1 switched to datafile copy "+DATA/orcl/datafile/system.257.830041439" datafile 2 switched to datafile copy "+DATA/orcl/datafile/sysaux.256.830041437" datafile 3 switched to datafile copy "+DATA/orcl/datafile/undotbs1.258.830041581" datafile 4 switched to datafile copy "+DATA/orcl/datafile/users.260.830041617" datafile 5 switched to datafile copy "+DATA/orcl/datafile/users01.259.830041581" #ok,完成数据文件的switch #恢复数据库 RMAN> recover database; #完成恢复,以resetlogs方式打开数据库。 RMAN> alter database open resetlogs; database opened SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- +DATA/orcl/datafile/system.257.830041439 +DATA/orcl/datafile/sysaux.256.830041437 +DATA/orcl/datafile/undotbs1.258.830041581 +DATA/orcl/datafile/users.260.830041617 +DATA/orcl/datafile/users01.259.830041581 #数据库打开成功,接下里就是迁移 tempfile,redo lofile,修改 数据库db_create_file_dest=+DATA SQL> create temporary tablespace temp tempfile '+DATA'; Tablespace created. SQL> select file_name from dba_temp_files; FILE_NAME -------------------------------------------------------------------------------- +SYSTEMDG/orcl/tempfile/temp1.267.830034603 +DATA/orcl/tempfile/temp.262.830042531 #修改默认临时表空间,并删除废弃的临时表空间以及数据文件 SQL> alter database default temporary tablespace temp; Database altered. SQL> drop tablespace temp1 including contents and datafiles; Tablespace dropped. SQL> show parameter control_files NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_files string +DATA/orcl/controlfile/current .261.830042181, +BACKUP/orcl/c ontrolfile/current.256.8295192 59 #修改db_create_file_dest SQL> show parameter db_create_file_dest NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_create_file_dest string +SYSTEMDG SQL> alter system set db_create_file_dest='+DATA' scope=spfile; System altered. #重启数据库,让参数生效 SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance ORACLE instance started. Total System Global Area 542814208 bytes Fixed Size 2230152 bytes Variable Size 180357240 bytes Database Buffers 352321536 bytes Redo Buffers 7905280 bytes Database mounted. Database opened. #最后 迁移redo logfile 采用 新加成员 删除废弃成员的方式来迁移 SQL> select member from v$logfile; MEMBER -------------------------------------------------------------------------------- +BACKUP/orcl/onlinelog/group_1.257.829519279 +SYSTEMDG/orcl/onlinelog/group_1.268.830035813 +BACKUP/orcl/onlinelog/group_2.258.829519305 +SYSTEMDG/orcl/onlinelog/group_2.269.830035825 +BACKUP/orcl/onlinelog/group_3.259.829519331 +SYSTEMDG/orcl/onlinelog/group_3.270.830035835 6 rows selected. SQL> alter database add logfile member '+DATA' to group 1; Database altered. SQL> alter database add logfile member '+DATA' to group 2; Database altered. SQL> alter database add logfile member '+DATA' to group 3; Database altered. SQL> alter system switch logfile; System altered. SQL> alter system checkpoint; System altered. SQL> alter database drop logfile member '+SYSTEMDG/orcl/onlinelog/group_1.268.830035813'; Database altered. #迁移参数文件 SQL> create pfile='$ORACLE_HOME/dbs/init_orcl.ora' from spfile; File created. SQL> shutdown immediate; ASM diskgroups dismounted ASM instance shutdown SQL> startup pfile='$ORACLE_HOME/dbs/init_orcl.ora'; ASM instance started Total System Global Area 283930624 bytes Fixed Size 2227664 bytes Variable Size 256537136 bytes ASM Cache 25165824 bytes ASM diskgroups mounted SQL> create spfile ='+DATA' from pfile='$ORACLE_HOME/dbs/init_orcl.ora'; File created. SQL> show parameter pfile NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ spfile string +DATA/asm/asmparameterfile/reg istry.253.830084811
#迁移redo logfile的时候,删除的时候,可能会因为是current 或者active状态无法删除,此时可根据实际情况
#使用 alter system switch logfile 或者 alter system checkpoint 来改变日志组的状态来达到删除的目的。
#至此,数据库存储从SYSTEMDG DISKGROUP 迁移到 DATA磁盘组完成

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The retention period of Oracle database logs depends on the log type and configuration, including: Redo logs: determined by the maximum size configured with the "LOG_ARCHIVE_DEST" parameter. Archived redo logs: Determined by the maximum size configured by the "DB_RECOVERY_FILE_DEST_SIZE" parameter. Online redo logs: not archived, lost when the database is restarted, and the retention period is consistent with the instance running time. Audit log: Configured by the "AUDIT_TRAIL" parameter, retained for 30 days by default.

The amount of memory required by Oracle depends on database size, activity level, and required performance level: for storing data buffers, index buffers, executing SQL statements, and managing the data dictionary cache. The exact amount is affected by database size, activity level, and required performance level. Best practices include setting the appropriate SGA size, sizing SGA components, using AMM, and monitoring memory usage.

Oracle database server hardware configuration requirements: Processor: multi-core, with a main frequency of at least 2.5 GHz. For large databases, 32 cores or more are recommended. Memory: At least 8GB for small databases, 16-64GB for medium sizes, up to 512GB or more for large databases or heavy workloads. Storage: SSD or NVMe disks, RAID arrays for redundancy and performance. Network: High-speed network (10GbE or higher), dedicated network card, low-latency network. Others: Stable power supply, redundant components, compatible operating system and software, heat dissipation and cooling system.

70B model, 1000 tokens can be generated in seconds, which translates into nearly 4000 characters! The researchers fine-tuned Llama3 and introduced an acceleration algorithm. Compared with the native version, the speed is 13 times faster! Not only is it fast, its performance on code rewriting tasks even surpasses GPT-4o. This achievement comes from anysphere, the team behind the popular AI programming artifact Cursor, and OpenAI also participated in the investment. You must know that on Groq, a well-known fast inference acceleration framework, the inference speed of 70BLlama3 is only more than 300 tokens per second. With the speed of Cursor, it can be said that it achieves near-instant complete code file editing. Some people call it a good guy, if you put Curs

Last week, amid the internal wave of resignations and external criticism, OpenAI was plagued by internal and external troubles: - The infringement of the widow sister sparked global heated discussions - Employees signing "overlord clauses" were exposed one after another - Netizens listed Ultraman's "seven deadly sins" Rumors refuting: According to leaked information and documents obtained by Vox, OpenAI’s senior leadership, including Altman, was well aware of these equity recovery provisions and signed off on them. In addition, there is a serious and urgent issue facing OpenAI - AI safety. The recent departures of five security-related employees, including two of its most prominent employees, and the dissolution of the "Super Alignment" team have once again put OpenAI's security issues in the spotlight. Fortune magazine reported that OpenA

The amount of memory required for an Oracle database depends on the database size, workload type, and number of concurrent users. General recommendations: Small databases: 16-32 GB, Medium databases: 32-64 GB, Large databases: 64 GB or more. Other factors to consider include database version, memory optimization options, virtualization, and best practices (monitor memory usage, adjust allocations).

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Oracle listeners are used to manage client connection requests. Startup steps include: Log in to the Oracle instance. Find the listener configuration. Use the lsnrctl start command to start the listener. Use the lsnrctl status command to verify startup.
