Friday, April 24, 2009

OBP commands

Use the following for setting boot parameters:

ok setenv boot-device disk disk1
ok setenv auto-boot? false/true

Use the following for debugging hardware (after putting the keyswitch into the diagnostics position):

ok setenv diag-level max
ok reset-all
ok probe-scsi-all
ok show-post-results

Wednesday, April 22, 2009

Ksh PS1 prompt

Set the below in the .profile and also a list of aliases in .kshrc

PS1='
('`uname -n`')'`/usr/ucb/whoami`':$PWD
$ '

Using parfiles for Oracle export

Always use a parfile for exporting from Oracle, a sample is below:


userid=system/*******
full=y
file=/u01/dbbackupdmp/exports/stage_exp.dmp
log=/u01/dbbackupdmp/exports/stage_exp.log
direct=y
recordlength=65535
statistics=none

and for importing:

userid=system/b1gkn0b
file=/u01/dbbackupdmp/exports/stage_exp.dmp
log=/u01/dbbackupdmp/exports/stage_impnorows.log
recordlength=65535
statistics=none
ignore=y
rows=n
constraints=n
indexes=n
fromuser=AGRESSO, CSMIG, DMSA
touser=AGRESSO, CSMIG, DMSA

To sucessfully reimport, follow this procedure:

1. Objects only (ignore=y,rows=n,indexes=n,constraints=n)
2. Data only (ignore=y,rows=y,indexes=n,constraints=n)
3. Contraints only ((ignore=y,rows=n,indexes=y,constraints=y)

Enable IO multipathing

When adding 3rd part SAN devices, the file /kernel/drv/scsi_vhci.conf needs to be edited to add multipathing support and then 'stmsboot -e' needs to be executed, which requires a reboot:

System Administration Commands stmsboot(1M)

NAME
stmsboot - administration program for the Solaris I/O mul-
tipathing feature

SYNOPSIS
/usr/sbin/stmsboot
[-d | -e | -u | -L | -l controller_number]

DESCRIPTION
The Solaris I/O multipathing feature is a multipathing solu-
tion for storage devices that is part of the Solaris operat-
ing environment. This feature was formerly known as Sun
StorEdge Traffic Manager (STMS) or MPxIO.

The stmsboot program is an administrative command to manage
enumeration of fibre channel devices under Solaris I/O mul-
tipathing. Solaris I/O multipathing-enabled devices are
enumerated under scsi_vhci(7D), providing multipathing capa-
bilities. Solaris I/O multipathing-disabled devices are
enumerated under the physical controller.

In the /dev and /devices trees, Solaris I/O multipathing-
enabled devices receive new names that indicate that they
are under Solaris I/O multipathing control. This means a
device will have a different name from its original name
(following installation) when it is under Solaris I/O mul-
tipathing control. The stmsboot command automatically
updates /etc/vfstab and dump configuration to reflect the
device names changes when enabling or disabling Solaris I/O
multipathing. A reboot is required for changes to take
effect.

RMAN: Restore archivelogs

This is a quick method of restoring rman archivelog files for database incomplete recovery. It is easier to simply use the rman catalog:

$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on Wed Apr 22 14:02:17 2009

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

connected to target database: TSTINET (DBID=1789357865)

RMAN> ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin/tdpo.opt)';

using target database control file instead of recovery catalog
allocated channel: ORA_MAINT_SBT_TAPE_1
channel ORA_MAINT_SBT_TAPE_1: sid=63 devtype=SBT_TAPE
channel ORA_MAINT_SBT_TAPE_1: Tivoli Data Protection for Oracle: version 5.2.0.0

you can now list the scn changes contained with the archivelog required (in this case seq 648)

RMAN> list backup of archivelog sequence 648;


List of Backup Sets
===================

BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
1597 76.75M SBT_TAPE 00:00:06 21-APR-09
BP Key: 1597 Status: AVAILABLE Compressed: NO Tag: TAG20090421T230314
Handle: TSTINET/TSTINET_al_t684802994_s1622_p1 Media: DISKPOOL

List of Archived Logs in backup set 1597
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 648 2324906766 20-APR-09 2324970620 21-APR-09

The archive log can now be restored:


RMAN> run
2> {
3> allocate channel ch1 type 'sbt_tape' parms
4> 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin/tdpo.opt)';
5> restore archivelog from scn 2324906766 until scn 2324970620;
6> }

Renaming a database

1. Cerate a create controlfile script with the command 'alter database backup controlfile to trace;'
2. Move the database to the new sid in /u02/oradata.
3. Move the admin directory and all relevant $ORACLE_HOME/dbs files.
4. Edit the control file so it contains the following command (change reuse to set):

CREATE CONTROLFILE SET DATABASE "TSTOLTP" RESETLOGS ARCHIVELOG

5. Receate the controlfile and simply run 'alter database open resetlogs;'.
6. Recreate the temporary tablespace.