Friday, October 28, 2011

HP-UX DOSKEY equivalent functionality

 

To use the DOSKEY functionality on the HP-UX, in your environment or execute on terminal

Code:

set -o vi

Then you hit escape then with 'k' and 'j' scroll commands (up and down ,like in vi editor).

Then you can use the keystroke sequence <esc>/k to present the last command typed for editing. Move backwards or forwards through the command history using the "-" or "+" keys respectively. If you find a command you want to edit, type "v" which will invoke "vi". Then after editing, use the usual ":wq!" to exit vi and the edited command will execute.

Tip: If you decide to not execute any command (edited or not), blank the command in vi (eg. the "dd" vi command) and then ":wq!".

Friday, October 14, 2011

Moving Data files Between ASM Disk Groups

 

Method 1: Using RMAN

Step 1: Start RMAN and connect to the target database.

$ rman target /

Step 2: Generate a report that shows the names of the datafiles.

RMAN> REPORT SCHEMA;

Step 3:  Back up the datafile to the new ASM disk group.

RMAN> BACKUP AS COPY DATAFILE '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' FORMAT '+DG_DEVSYS_mydb1_DATA_01';

Step 4:  Bring the Datafile Offline
alter database datafile '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' offline

Step 5: Point the control file to the newly created copy of the datafile

RMAN> SWITCH DATAFILE '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' TO COPY;

Step 6:  Recover the renamed datafile
RMAN> recover datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767';

Step 7. Bring the datafile online.
alter database datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767' online

Step 8. Delete the old datafile
RMAN>DELETE DATAFILECOPY “DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421”

Reference: http://download.oracle.com/docs/cd/B28359_01/backup.111/b28270/rcmasmmi.htm

Method 2: Using ASMCMD CP ( Copy ) Command

Step 1: Start RMAN and connect to the target database.

$ rman target /

Step 2: Generate a report that shows the names of the datafiles.

RMAN> REPORT SCHEMA;

Step 3:  Bring the Datafile Offline
alter database datafile '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' offline

Step 4:  Connect to ASMCMD and use CP to copy files
$ asmcmd –p

ASMCMD [+] > cp +DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421 +DG_DEVSYS_mydb1_DATA_01

Step 5:  After copied datafile, then rename file in database.  With ASM(OMF) this delete old datafile.

alter database rename file '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421'  to '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767'

Step 6:  Recover the renamed datafile
RMAN> recover datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767';

Step 7. Bring the datafile online.
alter database datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767' online

Step 8: Verify the file name
RMAN> REPORT SCHEMA


Method 3:  Using RMAN Copy

Step 1:  Restrict the Session
ALTER SYSTEM enable restricted session;

Step 2:   Bring the Datafile Offline

alter database datafile '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' offline

Step 3: Start RMAN and connect to the target database.

$ rman target /

Step 4:  RMAN Copy datafile
RMAN> copy datafile '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' to '+DG_DEVSYS_mydb1_DATA_01';

Step 5:  After copied datafile, then rename file in database.  With ASM(OMF) this delete old datafile.

alter database rename file '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421'  to '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767'

Step 6:  Recover the renamed datafile
RMAN> recover datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767';

Step 7. Bring the datafile online.
alter database datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767' online


Step 8: Verify the file name
RMAN> REPORT SCHEMA

Step 9: Disable the Restricted Session

ALTER SYSTEM disable restricted session;

Thursday, October 06, 2011

ORA-38729: Not enough flashback database log data to do FLASHBACK.

Just check the oldest flashback time available>

select oldest_flashback_time from v$flashback_database_log;

Cause:

We need to have the required archive logs in the archive destination at the time of flashback.

Like, there could be a  backup script is archiving all the archivelogs and purging it from the ASM, hence, we cannot flashback with the error that it cannot locate the log files.
 
Resolution:
 
That is, if the flashback database command does not work in SQLPlus because a needed archive log was deleted after an RMAN backup, execute the flashback database command from RMAN. RMAN will flashback the database, restore the missing archive log(s) and apply the logs as needed.

Then 'alter database open resetlogs ;' is executed after the flashback database as normal.

 

Ref: https://support.oracle.com Document ID 560686.1.

Wednesday, October 05, 2011

OEM Collection Status : Disabled by Upload Manager

 

oracle@DBSRVR1:/app/oracle/product/11g/db_1/network/admin $ oemagent status
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version     : 11.1.0.1.0
OMS Version       : 11.1.0.1.0
Protocol Version  : 11.1.0.0.0
Agent Home        : /app/oracle/product/em/agent11g/DBSRVR1.production.siva.com
Agent binaries    : /app/oracle/product/em/agent11g
Agent Process ID  : 16164
Parent Process ID : 18735
Agent URL         : https://DBSRVR1.production.siva.com:3872/emd/main
Repository URL    : https://GRIDCTLSRVR.siva.com:1159/em/upload
Started at        : 2011-10-03 12:25:14
Started by user   : oracle
Last Reload       : 2011-10-03 12:25:14
Last successful upload                       : 2011-10-05 18:32:35
Total Megabytes of XML files uploaded so far :  1400.06
Number of XML files pending upload           :      390
Size of XML files pending upload(MB)         :    51.97
Available disk space on upload filesystem    :    26.53%
Collection Status                            : Disabled by Upload Manager
Last attempted heartbeat to OMS              : 2011-10-05 20:44:10
Last successful heartbeat to OMS             : 2011-10-05 18:32:15
---------------------------------------------------------------
Agent is Running and Ready

Causes:

  1. There are too many files backlogged
  2. There is not enough free space on the directory
  3. The size of the files backlogged is too large.
  4. It could be of network issue between OEM Agent and OMS Server

Please check the emd.properties file to override the defaults that automatically disable collection