Oracle Database Experts

By Charles Kim

March 22nd, 2008

RMAN Archivelog Management

RMAN archivelog management
List archivelog all;

Delete a specific archivelog:
RMAN> delete archivelog logseq=22;

using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================

Key Thrd Seq S Low Time
——- —- ——- – ———
21 1 22 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_22.264.649776809

Do you really want to delete the above objects (enter YES or NO)? YES
deleted archived log
archived log file name=+DATA/visk4/archivelog/2008_03_19/thread_1_seq_22.264.649776809 RECID=21 STAMP=649776849
Deleted 1 objects

To delete a range of archivelogs:
RMAN> delete archivelog from logseq=20 until logseq=21;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================

Key Thrd Seq S Low Time
——- —- ——- – ———
20 1 21 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_21.293.649776759

Do you really want to delete the above objects (enter YES or NO)? YES
deleted archived log
archived log file name=+DATA/visk4/archivelog/2008_03_19/thread_1_seq_21.293.649776759 RECID=20 STAMP=649776805
Deleted 1 objects

To delete a range of archivelogs without being prompted:
RMAN> delete noprompt archivelog from logseq=22 until logseq=35;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================

Key Thrd Seq S Low Time
——- —- ——- – ———
22 1 23 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_23.292.649776857

23 1 24 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_24.291.649776903

24 1 25 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_25.290.649776949


To delete all the archivelogs;
Delete archivelog all;

RMAN archivelog management
List archivelog all;

Delete a specific archivelog:
RMAN> delete archivelog logseq=22;

using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================

Key Thrd Seq S Low Time
——- —- ——- – ———
21 1 22 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_22.264.649776809

Do you really want to delete the above objects (enter YES or NO)? YES
deleted archived log
archived log file name=+DATA/visk4/archivelog/2008_03_19/thread_1_seq_22.264.649776809 RECID=21 STAMP=649776849
Deleted 1 objects

To delete a range of archivelogs:
RMAN> delete archivelog from logseq=20 until logseq=21;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================

Key Thrd Seq S Low Time
——- —- ——- – ———
20 1 21 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_21.293.649776759

Do you really want to delete the above objects (enter YES or NO)? YES
deleted archived log
archived log file name=+DATA/visk4/archivelog/2008_03_19/thread_1_seq_21.293.649776759 RECID=20 STAMP=649776805
Deleted 1 objects

To delete a range of archivelogs without being prompted:
RMAN> delete noprompt archivelog from logseq=22 until logseq=35;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================

Key Thrd Seq S Low Time
——- —- ——- – ———
22 1 23 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_23.292.649776857

23 1 24 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_24.291.649776903

24 1 25 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_25.290.649776949


To delete all the archivelogs;
Delete archivelog all;

Delete all the archivelogs without being prompted:
RMAN> delete noprompt archivelog all;

using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=115 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================

To copy a single archivelog out of ASM:

RMAN> backup as copy archivelog from logseq=78 until logseq=78 format ‘/tmp/%t%r%s%p’;

Starting backup at 21-MAR-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=124 device type=DISK
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=78 RECID=77 STAMP=649959634
output file name=/tmp/649960068%r211 RECID=78 STAMP=649960076
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:15
Finished backup at 21-MAR-08

Posted by Charles Kim, Oracle ACE

March 19th, 2008

Setup VNCServer to autostart after a server reboot

Modify /etc/sysconfig/vncservers

# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my ‘myusername’ (adjust this to your own). You will also
# need to set a VNC password; run ‘man vncpasswd’ to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.

# Use “-nolisten tcp” to prevent X connections to your VNC server via TCP.

# Use “-nohttpd” to prevent web-based VNC clients connecting.

# Use “-localhost” to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the “-via” option in the
# `man vncviewer’ manual page.

VNCSERVERS=”1:oracle 2:root”
VNCSERVERARGS[1]=”-geometry 1024×768″

Once the changes are saved, Run “chkconfig vncserver on 345″ to enable autostartup. When the server reboots, two vncserver processes will start, one for root and the other for oracle.

March 18th, 2008

Setup NTP client

vi /etc/ntp.conf
Note: In the ntp.conf file, change the entries that start with server with your NTP server:
# — OUR TIMESERVERS —–
server 192.168.1.8
server 0.pool.ntp.org

Manually force a time update with the NTP Server:
ntpdate ip_of_ntp_server

Start the ntpd daemons:
service ntpd start

Add the ntpd for autostart:
chkconfig ntpd on 345

March 10th, 2008

Create a new file system

[root@gc ~]# fdisk -l

Disk /dev/hda: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 2040 16386268+ 83 Linux
/dev/hda2 2041 6119 32764567+ 83 Linux
/dev/hda3 6120 6641 4192965 82 Linux swap
/dev/hda4 6642 12161 44339400 5 Extended
/dev/hda5 6642 7163 4192933+ 83 Linux
/dev/hda6 7164 7662 4008186 83 Linux
/dev/hda7 7663 8161 4008186 83 Linux
/dev/hda8 8162 8660 4008186 83 Linux
/dev/hda9 8661 9159 4008186 83 Linux
/dev/hda10 9160 9658 4008186 83 Linux
/dev/hda11 9659 10281 5004216 83 Linux

[root@gc ~]# mke2fs -j /dev/hda11
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
626496 inodes, 1251054 blocks
62552 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1283457024
39 block groups
32768 blocks per group, 32768 fragments per group
16064 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@gc ~]# mkdir /nfs1
[root@gc ~]# vi /etc/fstab

# This file is edited by fstab-sync – see ‘man fstab-sync’ for details
LABEL=/ / ext3 defaults 1 1
LABEL=/apps /apps ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
LABEL=/tmp /tmp ext3 defaults 1 2
LABEL=SWAP-hda3 swap swap defaults 0 0
rac1.dbaexpert.com:/backups/oracle /backups/oracle nfs rw,rsize=32768,wsize=32768,tcp,hard,nointr,nfsvers=3,bg,actimeo=0,timeo=600,suid,async
/dev/hdc /media/cdrecorder auto pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
/dev/hda11 /nfs1 ext3 defaults 1 1

[root@gc ~]# mount /nfs1
[root@gc ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 16G 3.7G 11G 26% /
/dev/hda2 31G 26G 3.7G 88% /apps
none 1014M 566M 449M 56% /dev/shm
/dev/hda5 4.0G 41M 3.7G 2% /tmp
/dev/hda11 4.7G 42M 4.5G 1% /nfs1

[root@gc ~]# cd /nfs1
[root@gc nfs1]# mkdir oracle
[root@gc nfs1]# chown oracle:oinstall oracle
[root@gc nfs1]# ls -tlr
total 24
drwx—— 2 root root 16384 Mar 10 22:32 lost+found
drwxr-xr-x 2 oracle oinstall 4096 Mar 10 22:33 oracle




|