What is VNCserver?
VNC stands for Virtual Network Computing. It was originally developed by AT&T as a way to administer machines without using the console.
Why use VNCserver?
In Linux, everything can be done from a shell. However, there may be a time when you need to access the machine as if you were at the console.
Getting Started
You will need several things to get started:
* root privledges
* VNC client software (tightVNC, you can download it here.)
* A good password!
As I mentioned above, this example is done with RHEL, which comes standard with VNCserver installed. To start the vncserver simply invoke the following commands:
[root@vis2]# service vncserver start
Starting VNC server: [ OK ]
[root@vis2]#
[root@vis2]# vncpasswd
Password:
Verify:
[root@vis2]#
[root@vis2]# vncserver
New 'vis2.nrgc.co.za:2 (oracrs)' desktop is vis2.nrgc.co.za:2
Creating default startup script /home/oracrs/.vnc/xstartup
Starting applications specified in /home/oracrs/.vnc/xstartup
Log file is /home/oracrs/.vnc/vis2.nrgc.co.za:2.log
Thursday, May 6, 2010
Wednesday, April 14, 2010
LISTENER ISSUE, Can't start listener
PROBLEM:
{vis1.nrgc.co.za:}/oracle/product/102_64/network/log ->lsnrctl start LISTENER_DGP
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 14-APR-2010 11:38:48
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Starting /oracle/product/102_64/bin/tnslsnr: please wait...
TNS-12537: TNS:connection closed
TNS-12560: TNS:protocol adapter error
TNS-00507: Connection closed
Linux Error: 29: Illegal seek
SOLUTION:
I added 127.0.0.1 localhost to /etc/hosts
{vis1.nrgc.co.za:}/oracle/product/102_64/network/log ->lsnrctl start LISTENER_DGP
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 14-APR-2010 11:38:48
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Starting /oracle/product/102_64/bin/tnslsnr: please wait...
TNS-12537: TNS:connection closed
TNS-12560: TNS:protocol adapter error
TNS-00507: Connection closed
Linux Error: 29: Illegal seek
SOLUTION:
I added 127.0.0.1 localhost to /etc/hosts
Tuesday, April 13, 2010
How to configure FTP on RedHat Advanced Server
1. Install vsftpd package - (i used vsftpd-2.0.5-10.el5.x86_64.rpm )
2. How to get vsftpd started /stoped
[root@vis1 tmp]# /etc/init.d/vsftpd start
[root@vis1 tmp]# /etc/init.d/vsftpd stop
[root@vis1 tmp]# /etc/init.d/vsftpd restart
3. configure VSFTPD to start at boot
[root@vis1 tmp]# chkconfig vsftpd on
4. Testing the Status of VSFTPD
[root@vis1 rpm_pack]# netstat -a | grep ftp
tcp 0 0 *:ftp *:* LISTEN
If VSFTPD wasn't running, there would be no output at all.
5. How to enable a user like root to log on using ftp
edit the files by removing a user from these 2 files (root)
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
2. How to get vsftpd started /stoped
[root@vis1 tmp]# /etc/init.d/vsftpd start
[root@vis1 tmp]# /etc/init.d/vsftpd stop
[root@vis1 tmp]# /etc/init.d/vsftpd restart
3. configure VSFTPD to start at boot
[root@vis1 tmp]# chkconfig vsftpd on
4. Testing the Status of VSFTPD
[root@vis1 rpm_pack]# netstat -a | grep ftp
tcp 0 0 *:ftp *:* LISTEN
If VSFTPD wasn't running, there would be no output at all.
5. How to enable a user like root to log on using ftp
edit the files by removing a user from these 2 files (root)
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
Tuesday, March 23, 2010
extract files created by CPIO
file name is 10201_database_linux_x86_64.cpio
to extract
cpio -idcmv <10201_database_linux_x86_64.cpio
to extract
cpio -idcmv <10201_database_linux_x86_64.cpio
Friday, March 19, 2010
How to start vnc server on linux
[root@vis1 Oracle_binaries]# service vncserver start
Starting VNC server: no displays configured [ OK ]
[root@vis1 Oracle_binaries]# vncpasswd
Password:
Verify:
[root@vis1 Oracle_binaries]# vncserver
xauth: creating new authority file /root/.Xauthority
New 'vis1.nrgc.co.za:1 (root)' desktop is vis1.nrgc.co.za:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/vis1.nrgc.co.za:1.log
Starting VNC server: no displays configured [ OK ]
[root@vis1 Oracle_binaries]# vncpasswd
Password:
Verify:
[root@vis1 Oracle_binaries]# vncserver
xauth: creating new authority file /root/.Xauthority
New 'vis1.nrgc.co.za:1 (root)' desktop is vis1.nrgc.co.za:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/vis1.nrgc.co.za:1.log
Friday, January 29, 2010
ORA-01548: active rollback segment '_SYSSMU1$' found, terminate dropping tablespace
Problem Description
Drop undo tablespace fails with error Ora-01548 .
SQL> drop Tablespace UNDOTBS;
drop Tablespace UNDOTBS
*
ERROR at line 1:
ORA-01548: active rollback segment '_SYSSMU1$' found, terminate dropping
tablespace
Cause of The Problem
An attempt was made to drop a tablespace that contains active rollback segments.
Solution of The Problem
In order to get rid of this error you have to follow following steps.
1)Create pfile if you started with database with spfile.
SQL>Create PFILE from SPFILE;
2)Edit pfile and set undo management to manual.
undo_management = manual
3)Put the entries of the undo segments in the pfile by using the following statement in the pfile:
_offline_rollback_segments=(_SYSSMU1$,_SYSSMU2$,_SYSSMU3$,.....)
4)Mount the database using new pfile.
Startup mount pfile='fullpath to pfile'
5)Drop the datafiles,
sql>Alter Database datafile '&filename' offline drop;
6)Open the database.
sql>Alter Database Open;
7)Drop the undo segments,
sql>Drop Rollback Segment "_SYSSMU1$";
......
8)Drop Old undo tablespace.
sql>Drop Tablespace old_tablespace_name Including Contents;
9)Add the new undo tablespace.
10) Shutdown Immediate;
11) Change the pfile parameters back to Undo_management = AUTO and modify the parameter Undo_tablespace=new_undo_tablespace_name and remove the _offline_rollback_segments parameter.
12) Startup the Database.
Theoretical solution
So, why would anyone be dropping the current UNDO tablespace? Most likely to create a new UNDO tablespace to replace it, so why go through all of your listed gyrations when one can:
SQL> create undo tablespace undotbs2
2 datafile '/u01/data/undotbs2_01.dbf' size 2048M,
3 '/u02/data/undotbs2_02.dbf' size 2048M
3 blocksize 8192
4 extent management local autoallocate;
Tablespace created.
SQL> alter system set undo_tablespace = 'UNDOTBS2';
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
Oracle instance shut down.
SQL> startup
...
SQL> drop tablespace undotbs1 including contents and datafiles;
Tablespace dropped.
SQL>
As you need an UNDO tablespace present it only makes sense to create the new UNDO tablespace before dropping the old one. And, as you need to shutdown the database to clear all old transactions from the current, defective UNDO tablespace you're assured of having no active segments if you set the new UNDO tablespace as THE UNDO tablespace before you shutdown and restart the database.
I can't understand why you make simple topics complicated.
Drop undo tablespace fails with error Ora-01548 .
SQL> drop Tablespace UNDOTBS;
drop Tablespace UNDOTBS
*
ERROR at line 1:
ORA-01548: active rollback segment '_SYSSMU1$' found, terminate dropping
tablespace
Cause of The Problem
An attempt was made to drop a tablespace that contains active rollback segments.
Solution of The Problem
In order to get rid of this error you have to follow following steps.
1)Create pfile if you started with database with spfile.
SQL>Create PFILE from SPFILE;
2)Edit pfile and set undo management to manual.
undo_management = manual
3)Put the entries of the undo segments in the pfile by using the following statement in the pfile:
_offline_rollback_segments=(_SYSSMU1$,_SYSSMU2$,_SYSSMU3$,.....)
4)Mount the database using new pfile.
Startup mount pfile='fullpath to pfile'
5)Drop the datafiles,
sql>Alter Database datafile '&filename' offline drop;
6)Open the database.
sql>Alter Database Open;
7)Drop the undo segments,
sql>Drop Rollback Segment "_SYSSMU1$";
......
8)Drop Old undo tablespace.
sql>Drop Tablespace old_tablespace_name Including Contents;
9)Add the new undo tablespace.
10) Shutdown Immediate;
11) Change the pfile parameters back to Undo_management = AUTO and modify the parameter Undo_tablespace=new_undo_tablespace_name and remove the _offline_rollback_segments parameter.
12) Startup the Database.
Theoretical solution
So, why would anyone be dropping the current UNDO tablespace? Most likely to create a new UNDO tablespace to replace it, so why go through all of your listed gyrations when one can:
SQL> create undo tablespace undotbs2
2 datafile '/u01/data/undotbs2_01.dbf' size 2048M,
3 '/u02/data/undotbs2_02.dbf' size 2048M
3 blocksize 8192
4 extent management local autoallocate;
Tablespace created.
SQL> alter system set undo_tablespace = 'UNDOTBS2';
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
Oracle instance shut down.
SQL> startup
...
SQL> drop tablespace undotbs1 including contents and datafiles;
Tablespace dropped.
SQL>
As you need an UNDO tablespace present it only makes sense to create the new UNDO tablespace before dropping the old one. And, as you need to shutdown the database to clear all old transactions from the current, defective UNDO tablespace you're assured of having no active segments if you set the new UNDO tablespace as THE UNDO tablespace before you shutdown and restart the database.
I can't understand why you make simple topics complicated.
Wednesday, January 27, 2010
Moving datafiles when asm is involved
Moving Datafiles
Online Datafile Move
Steps
Copy datafile of the tablespace to the new diskgroup
Bring tablespace to offline mode
Switch datafile to its new location
Recover the tablespace
Bring tablespace to online mode
Example
RMAN> run{
2> ALLOCATE CHANNEL disk1 DEVICE TYPE DISK;
3> copy datafile 169 to ‘+DGRP’;
4> release channel disk1;
5> }
allocated channel: disk1
channel disk1: sid=450 devtype=DISK
Starting backup at 12-JUN-08 21:10:19
channel disk1: starting datafile copy
input datafile fno=00169 name=+DGROUP1/dds/datafile/cmp_default.463.645917347
output filename=+DGRP/dds/datafile/cmp_default.1093.657234623 tag=TAG20080612T211021 recid=7533 stamp=657234623
channel disk1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 12-JUN-08 21:10:25
Starting Control File and SPFILE Autobackup at 12-JUN-08 21:10:25
piece handle=+RGRP/dds/autobackup/2008_06_12/s_657234626.7000.657234627 comment=NONE
Finished Control File and SPFILE Autobackup at 12-JUN-08 21:10:30
released channel: disk1
RMAN> sql ‘alter tablespace cmp_default offline‘;
sql statement: alter tablespace cmp_default offline
RMAN> switch datafile 169 to copy;
datafile 169 switched to datafile copy “+DGRP/dds/datafile/cmp_default.1093.657234623″
RMAN> recover tablespace cmp_default;
Starting recover at 12-JUN-08 21:13:20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=450 devtype=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:02
Finished recover at 12-JUN-08 21:13:26
RMAN> sql ‘alter tablespace cmp_default online‘;
sql statement: alter tablespace cmp_default online
RMAN>
Move tablespace (Multiple datafiles)
Online Tablespace Move(Multiple Datafiles)
Steps
Copy tablespace (allfiles) to the new diskgroup
Bring tablespace to offline mode
Switch tablespace (all datafiles) to its new location
Recover the tablespace
Bring tablespace to online mode
Example
RMAN> run{
2> ALLOCATE CHANNEL disk1 DEVICE TYPE DISK;
3> ALLOCATE CHANNEL disk2 DEVICE TYPE DISK;
4> ALLOCATE CHANNEL disk3 DEVICE TYPE DISK;
5> ALLOCATE CHANNEL disk4 DEVICE TYPE DISK;
6> backup as copy tablespace USERS format ‘+DGRP’;
7> release channel disk1;
8> release channel disk2;
9> release channel disk3;
10> release channel disk4;
11> }
allocated channel: disk1
channel disk1: sid=450 devtype=DISK
allocated channel: disk2
channel disk2: sid=383 devtype=DISK
allocated channel: disk3
channel disk3: sid=232 devtype=DISK
allocated channel: disk4
channel disk4: sid=68 devtype=DISK
Starting backup at 12-JUN-08 21:38:03
channel disk1: starting datafile copy
input datafile fno=00112 name=+DGROUP1/dds/datafile/users.322.644072045
channel disk2: starting datafile copy
input datafile fno=00113 name=+DGROUP1/dds/datafile/users.321.644072157
channel disk3: starting datafile copy
input datafile fno=00114 name=+DGROUP1/dds/datafile/users.320.644072323
channel disk4: starting datafile copy
input datafile fno=00004 name=+DGROUP1/dds/datafile/users.261.643638281
output filename=+DGRP/dds/datafile/users.1097.657236289 tag=TAG20080612T213804 recid=7535 stamp=657236396
channel disk4: datafile copy complete, elapsed time: 00:01:55
output filename=+DGRP/dds/datafile/users.1094.657236285 tag=TAG20080612T213804 recid=7536 stamp=657236494
channel disk2: datafile copy complete, elapsed time: 00:03:31
output filename=+DGRP/dds/datafile/users.1095.657236285 tag=TAG20080612T213804 recid=7538 stamp=657236497
channel disk1: datafile copy complete, elapsed time: 00:03:34
output filename=+DGRP/dds/datafile/users.1096.657236289 tag=TAG20080612T213804 recid=7537 stamp=657236496
channel disk3: datafile copy complete, elapsed time: 00:03:34
Finished backup at 12-JUN-08 21:41:38
Starting Control File and SPFILE Autobackup at 12-JUN-08 21:41:38
piece handle=+RGRP/dds/autobackup/2008_06_12/s_657236498.6997.657236501 comment=NONE
Finished Control File and SPFILE Autobackup at 12-JUN-08 21:41:46
released channel: disk1
released channel: disk2
released channel: disk3
released channel: disk4
RMAN> sql ‘alter tablespace users offline’;
sql statement: alter tablespace users offline
RMAN> switch tablespace users to copy;
datafile 4 switched to datafile copy “+DGRP/dds/datafile/users.1097.657236289″
datafile 112 switched to datafile copy “+DGRP/dds/datafile/users.1095.657236285″
datafile 113 switched to datafile copy “+DGRP/dds/datafile/users.1094.657236285″
datafile 114 switched to datafile copy “+DGRP/dds/datafile/users.1096.657236289″
RMAN> recover tablespace users;
Starting recover at 12-JUN-08 21:44:32
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=450 devtype=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 12-JUN-08 21:44:40
RMAN> sql ‘alter tablespace users online’;
sql statement: alter tablespace users online
RMAN>
Less High Available Online Tablespace Move(Multiple Datafiles)
Steps
Bring tablespace to offline mode
Copy tablespace (allfiles) to the new diskgroup
Switch tablespace (all datafiles) to its new location
Bring tablespace to online mode
Different from the previous one this solution is the one explained in Metalink Note:390274.1
Taking datafiles offline before starting the copy operation makes recovery unnecessary. However if the tablespaces are too large (Big File tablespaces are heavily used in our datawarehouse. A single file of size 5 TB), tablespace will be unavailable till the end of copy operation.
Example
RMAN> sql ‘alter tablespace TRF_BIG_B_2006M05 offline’;
sql statement: alter tablespace TRF_BIG_B_2006M05 offline
RMAN> run{
2> ALLOCATE CHANNEL disk1 DEVICE TYPE DISK;
3> backup as copy tablespace TRF_BIG_B_2006M05 format ‘+DGRP’;
4> release channel disk1;
5> }
allocated channel: disk1
channel disk1: sid=450 devtype=DISK
Starting backup at 12-JUN-08 21:49:17
channel disk1: starting datafile copy
input datafile fno=00030 name=+DGROUP1/dds/datafile/trf_big_b_2006m05.388.644681639
output filename=+DGRP/dds/datafile/trf_big_b_2006m05.1098.657236959 tag=TAG20080612T214918 recid=7543 stamp=657236968
channel disk1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 12-JUN-08 21:49:33
Starting Control File and SPFILE Autobackup at 12-JUN-08 21:49:33
piece handle=+RGRP/dds/autobackup/2008_06_12/s_657236973.6993.657236975 comment=NONE
Finished Control File and SPFILE Autobackup at 12-JUN-08 21:49:37
released channel: disk1
RMAN> switch tablespace TRF_BIG_B_2006M05 to copy;
datafile 30 switched to datafile copy “+DGRP/dds/datafile/trf_big_b_2006m05.1098.657236959″
RMAN> sql ‘alter tablespace TRF_BIG_B_2006M05 online’;
sql statement: alter tablespace TRF_BIG_B_2006M05 online
RMAN>
Online More than One Tablespace Move
Steps
Copy all tablespaces (allfiles) to the new diskgroup
Do for all tablespaces you move
Bring tablespace to offline mode
Switch tablespace (all datafiles) to its new location
Recover the tablespace
Bring tablespace to online mode
If you move more than one tablespace using this approach will decrease the manual work you do.
Example
RMAN> run{
2> ALLOCATE CHANNEL disk1 DEVICE TYPE DISK;
3> ALLOCATE CHANNEL disk2 DEVICE TYPE DISK;
4> backup as copy tablespace COMPRESSED_BTS,COMPRESS_BTS_02 format ‘+DGRP’;
5> release channel disk1;
6> release channel disk2;
7> }
allocated channel: disk1
channel disk1: sid=450 devtype=DISK
allocated channel: disk2
channel disk2: sid=383 devtype=DISK
Starting backup at 12-JUN-08 21:56:17
channel disk1: starting datafile copy
input datafile fno=00163 name=+DGROUP1/dds/datafile/compressed_bts.298.644699643
channel disk2: starting datafile copy
input datafile fno=00164 name=+DGROUP1/dds/datafile/compress_bts_02.297.644708473
output filename=+DGRP/dds/datafile/compress_bts_02.1100.657237379 tag=TAG20080612T215617 recid=7545 stamp=657237431
channel disk2: datafile copy complete, elapsed time: 00:00:55
output filename=+DGRP/dds/datafile/compressed_bts.1099.657237379 tag=TAG20080612T215617 recid=7546 stamp=657238158
channel disk1: datafile copy complete, elapsed time: 00:13:10
Finished backup at 12-JUN-08 22:09:28
Starting Control File and SPFILE Autobackup at 12-JUN-08 22:09:29
piece handle=+RGRP/dds/autobackup/2008_06_12/s_657238169.6991.657238171 comment=NONE
Finished Control File and SPFILE Autobackup at 12-JUN-08 22:09:33
released channel: disk1
released channel: disk2
RMAN> sql ‘alter tablespace COMPRESSED_BTS offline’;
sql statement: alter tablespace COMPRESSED_BTS offline
RMAN> sql ‘alter tablespace COMPRESS_BTS_02 offline’;
sql statement: alter tablespace COMPRESS_BTS_02 offline
RMAN> switch tablespace COMPRESSED_BTS,COMPRESS_BTS_02 to copy;
datafile 163 switched to datafile copy “+DGRP/dds/datafile/compressed_bts.1099.657237379″
datafile 164 switched to datafile copy “+DGRP/dds/datafile/compress_bts_02.1100.657237379″
RMAN> recover tablespace COMPRESS_BTS_02,COMPRESSED_BTS;
starting media recovery
media recovery complete, elapsed time: 00:00:02
Finished recover at 12-JUN-08 22:25:25
RMAN> sql ‘alter tablespace COMPRESS_BTS_02 online’;
sql statement: alter tablespace COMPRESS_BTS_02 online
RMAN> sql ‘alter tablespace COMPRESSED_BTS online’;
sql statement: alter tablespace COMPRESSED_BTS online
RMAN>
Offline Tablespace Move
Unfortunately, if you need to move SYSTEM or SYSAUX tablespaces to some other diskgroup, you are unlucky. You need to shutdown your database for a while.
Steps
shutdown your database
startup it in mount mode
copy datafile to new diskgroup
switch datafiles to new diskgroup
Open your database
Sample
himalaya@oracle $ srv
SQL*Plus: Release 10.2.0.3.0 – Production on Fri Jun 13 00:07:00 2008
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 – 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.
Total System Global Area 1.6106E+10 bytes
Fixed Size 2402240 bytes
Variable Size 2843793472 bytes
Database Buffers 1.3237E+10 bytes
Redo Buffers 22708224 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 – 64bit Production
With the Partitioning, OLAP and Data Mining options
himalaya@oracle $ rman target /
Recovery Manager: Release 10.2.0.3.0 – Production on Fri Jun 13 00:13:39 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: DDS (DBID=1378915377, not open)
RMAN> copy datafile 1 to ‘+DGRP’;
Starting backup at 13-JUN-08 00:51:49
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=77 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=+DGROUP1/dds/datafile/system.258.643638267
output filename=+DGRP/dds/datafile/system.1102.657247927 tag=TAG20080613T005205 recid=7551 stamp=657247953
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
Finished backup at 13-JUN-08 00:52:40
Starting Control File and SPFILE Autobackup at 13-JUN-08 00:52:41
piece handle=+RGRP/dds/autobackup/2008_06_13/s_657247505.6986.657247963 comment=NONE
Finished Control File and SPFILE Autobackup at 13-JUN-08 00:52:49
RMAN> switch datafile 1 to copy;
datafile 1 switched to datafile copy “+DGRP/dds/datafile/system.1102.657247927″
RMAN> alter database open;
database opened
RMAN>
Online Datafile Move
Steps
Copy datafile of the tablespace to the new diskgroup
Bring tablespace to offline mode
Switch datafile to its new location
Recover the tablespace
Bring tablespace to online mode
Example
RMAN> run{
2> ALLOCATE CHANNEL disk1 DEVICE TYPE DISK;
3> copy datafile 169 to ‘+DGRP’;
4> release channel disk1;
5> }
allocated channel: disk1
channel disk1: sid=450 devtype=DISK
Starting backup at 12-JUN-08 21:10:19
channel disk1: starting datafile copy
input datafile fno=00169 name=+DGROUP1/dds/datafile/cmp_default.463.645917347
output filename=+DGRP/dds/datafile/cmp_default.1093.657234623 tag=TAG20080612T211021 recid=7533 stamp=657234623
channel disk1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 12-JUN-08 21:10:25
Starting Control File and SPFILE Autobackup at 12-JUN-08 21:10:25
piece handle=+RGRP/dds/autobackup/2008_06_12/s_657234626.7000.657234627 comment=NONE
Finished Control File and SPFILE Autobackup at 12-JUN-08 21:10:30
released channel: disk1
RMAN> sql ‘alter tablespace cmp_default offline‘;
sql statement: alter tablespace cmp_default offline
RMAN> switch datafile 169 to copy;
datafile 169 switched to datafile copy “+DGRP/dds/datafile/cmp_default.1093.657234623″
RMAN> recover tablespace cmp_default;
Starting recover at 12-JUN-08 21:13:20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=450 devtype=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:02
Finished recover at 12-JUN-08 21:13:26
RMAN> sql ‘alter tablespace cmp_default online‘;
sql statement: alter tablespace cmp_default online
RMAN>
Move tablespace (Multiple datafiles)
Online Tablespace Move(Multiple Datafiles)
Steps
Copy tablespace (allfiles) to the new diskgroup
Bring tablespace to offline mode
Switch tablespace (all datafiles) to its new location
Recover the tablespace
Bring tablespace to online mode
Example
RMAN> run{
2> ALLOCATE CHANNEL disk1 DEVICE TYPE DISK;
3> ALLOCATE CHANNEL disk2 DEVICE TYPE DISK;
4> ALLOCATE CHANNEL disk3 DEVICE TYPE DISK;
5> ALLOCATE CHANNEL disk4 DEVICE TYPE DISK;
6> backup as copy tablespace USERS format ‘+DGRP’;
7> release channel disk1;
8> release channel disk2;
9> release channel disk3;
10> release channel disk4;
11> }
allocated channel: disk1
channel disk1: sid=450 devtype=DISK
allocated channel: disk2
channel disk2: sid=383 devtype=DISK
allocated channel: disk3
channel disk3: sid=232 devtype=DISK
allocated channel: disk4
channel disk4: sid=68 devtype=DISK
Starting backup at 12-JUN-08 21:38:03
channel disk1: starting datafile copy
input datafile fno=00112 name=+DGROUP1/dds/datafile/users.322.644072045
channel disk2: starting datafile copy
input datafile fno=00113 name=+DGROUP1/dds/datafile/users.321.644072157
channel disk3: starting datafile copy
input datafile fno=00114 name=+DGROUP1/dds/datafile/users.320.644072323
channel disk4: starting datafile copy
input datafile fno=00004 name=+DGROUP1/dds/datafile/users.261.643638281
output filename=+DGRP/dds/datafile/users.1097.657236289 tag=TAG20080612T213804 recid=7535 stamp=657236396
channel disk4: datafile copy complete, elapsed time: 00:01:55
output filename=+DGRP/dds/datafile/users.1094.657236285 tag=TAG20080612T213804 recid=7536 stamp=657236494
channel disk2: datafile copy complete, elapsed time: 00:03:31
output filename=+DGRP/dds/datafile/users.1095.657236285 tag=TAG20080612T213804 recid=7538 stamp=657236497
channel disk1: datafile copy complete, elapsed time: 00:03:34
output filename=+DGRP/dds/datafile/users.1096.657236289 tag=TAG20080612T213804 recid=7537 stamp=657236496
channel disk3: datafile copy complete, elapsed time: 00:03:34
Finished backup at 12-JUN-08 21:41:38
Starting Control File and SPFILE Autobackup at 12-JUN-08 21:41:38
piece handle=+RGRP/dds/autobackup/2008_06_12/s_657236498.6997.657236501 comment=NONE
Finished Control File and SPFILE Autobackup at 12-JUN-08 21:41:46
released channel: disk1
released channel: disk2
released channel: disk3
released channel: disk4
RMAN> sql ‘alter tablespace users offline’;
sql statement: alter tablespace users offline
RMAN> switch tablespace users to copy;
datafile 4 switched to datafile copy “+DGRP/dds/datafile/users.1097.657236289″
datafile 112 switched to datafile copy “+DGRP/dds/datafile/users.1095.657236285″
datafile 113 switched to datafile copy “+DGRP/dds/datafile/users.1094.657236285″
datafile 114 switched to datafile copy “+DGRP/dds/datafile/users.1096.657236289″
RMAN> recover tablespace users;
Starting recover at 12-JUN-08 21:44:32
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=450 devtype=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 12-JUN-08 21:44:40
RMAN> sql ‘alter tablespace users online’;
sql statement: alter tablespace users online
RMAN>
Less High Available Online Tablespace Move(Multiple Datafiles)
Steps
Bring tablespace to offline mode
Copy tablespace (allfiles) to the new diskgroup
Switch tablespace (all datafiles) to its new location
Bring tablespace to online mode
Different from the previous one this solution is the one explained in Metalink Note:390274.1
Taking datafiles offline before starting the copy operation makes recovery unnecessary. However if the tablespaces are too large (Big File tablespaces are heavily used in our datawarehouse. A single file of size 5 TB), tablespace will be unavailable till the end of copy operation.
Example
RMAN> sql ‘alter tablespace TRF_BIG_B_2006M05 offline’;
sql statement: alter tablespace TRF_BIG_B_2006M05 offline
RMAN> run{
2> ALLOCATE CHANNEL disk1 DEVICE TYPE DISK;
3> backup as copy tablespace TRF_BIG_B_2006M05 format ‘+DGRP’;
4> release channel disk1;
5> }
allocated channel: disk1
channel disk1: sid=450 devtype=DISK
Starting backup at 12-JUN-08 21:49:17
channel disk1: starting datafile copy
input datafile fno=00030 name=+DGROUP1/dds/datafile/trf_big_b_2006m05.388.644681639
output filename=+DGRP/dds/datafile/trf_big_b_2006m05.1098.657236959 tag=TAG20080612T214918 recid=7543 stamp=657236968
channel disk1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 12-JUN-08 21:49:33
Starting Control File and SPFILE Autobackup at 12-JUN-08 21:49:33
piece handle=+RGRP/dds/autobackup/2008_06_12/s_657236973.6993.657236975 comment=NONE
Finished Control File and SPFILE Autobackup at 12-JUN-08 21:49:37
released channel: disk1
RMAN> switch tablespace TRF_BIG_B_2006M05 to copy;
datafile 30 switched to datafile copy “+DGRP/dds/datafile/trf_big_b_2006m05.1098.657236959″
RMAN> sql ‘alter tablespace TRF_BIG_B_2006M05 online’;
sql statement: alter tablespace TRF_BIG_B_2006M05 online
RMAN>
Online More than One Tablespace Move
Steps
Copy all tablespaces (allfiles) to the new diskgroup
Do for all tablespaces you move
Bring tablespace to offline mode
Switch tablespace (all datafiles) to its new location
Recover the tablespace
Bring tablespace to online mode
If you move more than one tablespace using this approach will decrease the manual work you do.
Example
RMAN> run{
2> ALLOCATE CHANNEL disk1 DEVICE TYPE DISK;
3> ALLOCATE CHANNEL disk2 DEVICE TYPE DISK;
4> backup as copy tablespace COMPRESSED_BTS,COMPRESS_BTS_02 format ‘+DGRP’;
5> release channel disk1;
6> release channel disk2;
7> }
allocated channel: disk1
channel disk1: sid=450 devtype=DISK
allocated channel: disk2
channel disk2: sid=383 devtype=DISK
Starting backup at 12-JUN-08 21:56:17
channel disk1: starting datafile copy
input datafile fno=00163 name=+DGROUP1/dds/datafile/compressed_bts.298.644699643
channel disk2: starting datafile copy
input datafile fno=00164 name=+DGROUP1/dds/datafile/compress_bts_02.297.644708473
output filename=+DGRP/dds/datafile/compress_bts_02.1100.657237379 tag=TAG20080612T215617 recid=7545 stamp=657237431
channel disk2: datafile copy complete, elapsed time: 00:00:55
output filename=+DGRP/dds/datafile/compressed_bts.1099.657237379 tag=TAG20080612T215617 recid=7546 stamp=657238158
channel disk1: datafile copy complete, elapsed time: 00:13:10
Finished backup at 12-JUN-08 22:09:28
Starting Control File and SPFILE Autobackup at 12-JUN-08 22:09:29
piece handle=+RGRP/dds/autobackup/2008_06_12/s_657238169.6991.657238171 comment=NONE
Finished Control File and SPFILE Autobackup at 12-JUN-08 22:09:33
released channel: disk1
released channel: disk2
RMAN> sql ‘alter tablespace COMPRESSED_BTS offline’;
sql statement: alter tablespace COMPRESSED_BTS offline
RMAN> sql ‘alter tablespace COMPRESS_BTS_02 offline’;
sql statement: alter tablespace COMPRESS_BTS_02 offline
RMAN> switch tablespace COMPRESSED_BTS,COMPRESS_BTS_02 to copy;
datafile 163 switched to datafile copy “+DGRP/dds/datafile/compressed_bts.1099.657237379″
datafile 164 switched to datafile copy “+DGRP/dds/datafile/compress_bts_02.1100.657237379″
RMAN> recover tablespace COMPRESS_BTS_02,COMPRESSED_BTS;
starting media recovery
media recovery complete, elapsed time: 00:00:02
Finished recover at 12-JUN-08 22:25:25
RMAN> sql ‘alter tablespace COMPRESS_BTS_02 online’;
sql statement: alter tablespace COMPRESS_BTS_02 online
RMAN> sql ‘alter tablespace COMPRESSED_BTS online’;
sql statement: alter tablespace COMPRESSED_BTS online
RMAN>
Offline Tablespace Move
Unfortunately, if you need to move SYSTEM or SYSAUX tablespaces to some other diskgroup, you are unlucky. You need to shutdown your database for a while.
Steps
shutdown your database
startup it in mount mode
copy datafile to new diskgroup
switch datafiles to new diskgroup
Open your database
Sample
himalaya@oracle $ srv
SQL*Plus: Release 10.2.0.3.0 – Production on Fri Jun 13 00:07:00 2008
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 – 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.
Total System Global Area 1.6106E+10 bytes
Fixed Size 2402240 bytes
Variable Size 2843793472 bytes
Database Buffers 1.3237E+10 bytes
Redo Buffers 22708224 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 – 64bit Production
With the Partitioning, OLAP and Data Mining options
himalaya@oracle $ rman target /
Recovery Manager: Release 10.2.0.3.0 – Production on Fri Jun 13 00:13:39 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: DDS (DBID=1378915377, not open)
RMAN> copy datafile 1 to ‘+DGRP’;
Starting backup at 13-JUN-08 00:51:49
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=77 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=+DGROUP1/dds/datafile/system.258.643638267
output filename=+DGRP/dds/datafile/system.1102.657247927 tag=TAG20080613T005205 recid=7551 stamp=657247953
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
Finished backup at 13-JUN-08 00:52:40
Starting Control File and SPFILE Autobackup at 13-JUN-08 00:52:41
piece handle=+RGRP/dds/autobackup/2008_06_13/s_657247505.6986.657247963 comment=NONE
Finished Control File and SPFILE Autobackup at 13-JUN-08 00:52:49
RMAN> switch datafile 1 to copy;
datafile 1 switched to datafile copy “+DGRP/dds/datafile/system.1102.657247927″
RMAN> alter database open;
database opened
RMAN>
Subscribe to:
Posts (Atom)