Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Author: Ernie Migrate a RAC Database to a Single Instance Database on another Server You can use DBCA, RCONFIG or Enterprise Manager to migrate a Single instance database to a RAC database, but how do you convert a RAC database to a Single instance database? This document details the steps I took to migrate a RAC database to a single instance database on to another Linux server. Step 1. Install or Verify Linux packages Command As the root user Verify that the following packages are installed: libXp-1.0.0-8.1.el5.i386.rpm libXp-1.0.0-8.1.el5.x86_64.rpm libaio-devel-0.3.106-5.x86_64.rpm 2. Create Oracle O/S Accounts Create OS Groups: As root user: /usr/sbin/groupadd -g 502 dba /usr/sbin/groupadd -g 501 oinstall /usr/sbin/groupadd -g 503 oper /usr/sbin/groupadd -g 504 asmadmin /usr/sbin/groupadd -g 506 asmdba Create Oracle OS group and owner and asm accounts on new node before attempting this exercise. Before installing Oracle software set the correct profile and permissions for the file systems where the Installation and database in going to reside. Create Oracle User: /usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba oracle /usr/sbin/useradd -u 502 -g oinstall -G dba oracle Set Permissions: chown -R oracle:oinstall /u01 chown -R oracle:oinstall /u02 chown oracle:oinstall /etc/oratab chmod 775 /etc/oratab 3. Configure ulimits and kernel parameters. As root user set Resource Limits & Kernel Parameters: vi /etc/security/limits.conf oracle oracle oracle oracle oracle Relational Database Consulting soft hard soft hard soft nproc nproc nofile nofile stack 2047 16384 1024 65536 10240 Page 1 vi /etc/sysctl.conf fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 4294967295 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 4. Install Oracle Software Run the Oracle Installer and Install the software. Once the Oracle OS Accounts has been created and Kernel parameters and resource limits and permissions have been set then proceed with Oracle Installation. 5. Logon as the Oracle user on the production system and set the correct Oracle environment for the database . oraenv <sid_name> 6. Connect as sysdba sqlplus as sysdba 7. Execute the following command to switch logfile and backup the control file to trace alter system switch logfile; alter database backup controlfile to trace; 8. Perform an offline Rman backup if possible of your production system, otherwise run a compressed online backup to disk and include archivelogs. This backup will be used to restore as a single Instance to another node. Set the CONTROLFILE AUTOBACKUP on so that we have the controlfile backed up after the database backup. Set up Rman scripts for restore on new node. connect target / run{ allocate channel t1 device type disk1; backup incremental level 0 cumulative as compressed backupset format '/backup/rman/dbname/rman_%U' tag 'RMAN_DB_FULL' backup as compressed backupset format '/backup/rman/dbname/rman_arch_%U' tag 'RMAN_ARC' archivelog all; backup current controlfile format Relational Database Consulting Page 2 '/backup/rman/dbname/rman_rman_cntrl_%u' tag 'RMAN_CNTRL'; release channel ch_disk1; } 9. From the production RAC system create a pfile from the spfile for the single instance database and copy pfile across to new node Create pfile from spfile; 10. Check the file systems if it differs from the RAC system then modify the following parameters according to file system structure on the new node in your pfile: audit_file_dest, background_dump_dest, control_files, core_dump_dest, log_archive_dest_1, user_dump_dest ftp <pfile_name> to new server 11. Remove all RAC specific parameters Edit and modify pfile accordingly. in pfile such as cluster_database_instances, cluster_database 12. Modify pfile undo_tablespace parameter and use any one of the undo tablespace names UNDOTBS1 or UNDOTBS2 Edit and modify pfile accordingly undo_tablespace = UNDOTBS1 13. Once the rman database backup and archive backup pieces have been copied to the new server and also pfile have modified accordingly then: startup instance on new server. . oraenv <sid_name> sqlplus “/ as sysdba” startup nomount pfile=’$Oracle_Home’/dbs/initdbname.ora 14. Connect to an Rman session on new server - set DBID and restore controlfile from backup piece on new node rman target / nocatalog set DBID=12345678; restore controlfile to '/u01/oradata/dbname/cntrl01.ctl' from '/backup/rman/dbname/cntrl_auto_c-387244080420130306-11'; 15. Once the controlfile has been restored successfully – mount the database. alter database mount; 16. If the RMAN backup pieces have been copied to exactly the same location they were backed up on production then you may proceed with the restore, if not catalog the backup pieces. catalog start with '/backup/rman/dbname'; Relational Database Consulting Page 3 17. While connected to rman identify the point up to which media recovery should run on the restored database. list backup of archivelog all; 18. Restore database and point it to new location if necessary. run { set newname for datafile 1 to '/u02/oradata/dbname/system.273.716601193'; set newname for datafile 2 to '/u01/oradata/dbname /undotbs1.272.716601197'; set newname for datafile 3 to '/u02/oradata/dbname /sysaux.279.716601197'; set newname for datafile 4 to '/u01/oradata/dbname /undotbs2.280.716601201'; set newname for datafile 5 to '/u01/oradata/dbname /file.dbf'; set newname for datafile 6 to '/u01/oradata/dbname /isastore_data.283.716605103'; set newname for datafile 7 to '/u01/oradata/dbname /data.263.716605113'; set newname for datafile 8 to '/u02/oradata/dbname /data.265.716605123'; set newname for datafile 9 to '/u02/oradata/dbname /data.264.716605135'; set newname for datafile 10 to '/u02/oradata/dbname /data.271.716605151'; set newname for datafile 11 to '/u02/oradata/dbname /data.277.737816949'; set newname for datafile 12 to '/u02/oradata/dbname /data.536.740755877'; set newname for datafile 13 to '/u02/oradata/dbname /logminer_data.740.742650801'; restore database; switch datafile all; recover database noredo; } 19. Check production system archive format and modify accordingly: alter system set log_archive_format = 'log_%t_%s_%r.arc' scope =spfile; show parameter DB_RECOVERY_FILE_DEST alter system set DB_RECOVERY_FILE_DEST = '/u02/oradata/ dbname/archive'; Set archive location on file system. 20. Once the database has been restored and you have identified the point up to which media recovery should run, start the restore process. Relational Database Consulting rman target / catalog start with '/backup/rman/arch'; run { Page 4 Catalog the archivelogs and start the recovery process. set archivelog destination to '/u02/oradata/dbname/archive'; set until sequence 157320 thread 2; recover database; } 21. Once the restore and recovery has completed then rename the redo logs and point to file system locations as it is still pointing to ASM alter database rename file alter database rename file '+DG_DATA/dbname/onlinelog/group_20.2862.7616721 79' to '/u02/oradata/dbname/redo20.log'; alter database rename file '+DG_DATA/dbname/onlinelog/group_21.2950.7616721 97' to '/u02/oradata/dbname/redo21.log'; alter database rename file '+DG_DATA/dbname/onlinelog/group_22.2802.7616722 03' to '/u02/oradata/dbname/redo22.log'; alter database rename file '+DG_DATA/dbname/onlinelog/group_23.2937.7616722 11' to '/u02/oradata/dbname/redo23.log'; alter database rename file '+DG_DATA/dbname/onlinelog/group_24.2623.7616722 17' to '/u02/oradata/dbname/redo24.log'; alter database rename file '+DG_DATA/dbname/onlinelog/group_25.2896.7616722 33' to '/u02/oradata/dbname/redo25.log'; alter database rename file '+DG_DATA/dbname/onlinelog/group_26.2174.7616722 39' to '/u02/oradata/dbname/redo26.log'; alter database rename file '+DG_DATA/dbname/onlinelog/group_27.2790.7616722 51' to '/u02/oradata/dbname/redo27.log'; alter database rename file '+DG_DATA/dbname/onlinelog/group_30.2669.7616722 17' to '/u02/oradata/dbname/redo30.log'; alter database rename file '+DG_DATA/dbname/onlinelog/group_31.1954.761672225' to '/u02/oradata/dbname/redo31.log'; select member from v$logfile; 22. Proceed to open database alter database open resetlogs; 23. Once the database has been opened successfully, proceed to remove the redo log groups for redo threads of other instances. select THREAD#, STATUS, ENABLED from v$thread; select group# from v$log where THREAD#=2; alter database disable thread 2; alter database drop logfile group 23; alter database clear unarchived logfile group 23; Relational Database Consulting Page 5 24. If there are any ora-00312 errors– then clear all unarchived logfiles and ensure that the correct archivelog location has been set '/u02/oradata/dbname/redo23.log' ORA-16032: parameter LOG_ARCHIVE_DEST_1 destination string cannot be translated ORA-19801: initialization parameter DB_RECOVERY_FILE_DEST is not set 25. Drop the other undo tablespace of the second node. sho parameter undo; select tablespace_name from dba_tablespaces where contents='UNDO'; drop tablespace UNDOTBS2 including contents and datafiles; 26. Drop and re-create temporary tablespace and alter database to user new temp tablespace select tablespace_name from dba_tablespaces where contents='TEMPORARY'; create temporary tablespace TEMP2 tempfile '/u01/oradata/dbname//temp01.dbf' size 2000M; alter tablespace TEMP2 add tempfile '/u01/oradata/dbname/temp02.dbf' size 2000M; alter database DEFAULT TEMPORARY TABLESPACE TEMP2; drop tablespace TEMP including contents and datafiles; Applications need to point to new node where single instance has been setup and configured for testing etc 27. Setup listener and tnsnames files to point to new database and ensure that the connections to the database are fine. Author: Ernie Relational Database Consulting Page 6