Visit Counter

Sunday, October 14, 2012

How to enable Xmanager remote access SUSE Linux 10





You can enable the remote login as following steps.



1. vi /etc/X11/xdm/Xaccess

Remove the below comment symbol of following line.

#any host can get a login windows



 2. vi /etc/X11/xdm-config

comment out this line using the exclamation mark as following.


!DisplayManager.requestPort:    0


3. vi /etc/sysconfig/displaymanager

Change the first parameter to yes and the second parameter to yes in need.

DISPLAYMANAGER_REMOTE_ACCESS="yes"

DISPLAYMANAGER_ROOT_LOGIN_REMOTE="yes"



4. restart the xdm daemon

/usr/sbin/rcxdm restart






Tuesday, June 5, 2012

Unix Script for Copy Files to another Directory




root@test-server # cat mvfile.sh


SRCE_DIR=${HOME}/oradat/ssdb/archive1
DEST_DIR=${HOME}/backup/archive1

cd ${SRCE_DIR}

for FILE in `ls -1A *.dbf`
do

  if [ ! -f ${DEST_DIR}/${FILE} ]
  then
    echo 'Transferring file: '${FILE}
    cp "${FILE}" "${DEST_DIR}/${FILE}"
   
echo 'Transfer completed.'
  else
    echo 'The file: '${FILE}' already exists in '${DEST_DIR}'.'
  fi
done
root@test-server #

Saturday, June 2, 2012

Oracle Database Point In Time Recovery
















Database point-in-time recovery (DBPITR) restores the database from backups prior to the target time
for recovery, then use incremental backups and redo to roll the database forward to the target time.





Recover Archive Redo Logs Files



Catalog the missing archives to the controlfile as follow.


RMAN> catalog archivelog '/ora_dat/arc/1_14372_694624922';


RMAN> catalog start with '/ora_dat/arc' noprompt;


RMAN> list archivelog from sequence 14372 until sequence 14446;


RMAN>  run
{
set until sequence 14446;
recover database;
}

RMAN>

SQL> shutdown immediate;

SQL> alter database open resetlogs;

SQL>






Tuesday, May 29, 2012

Oracle Online Backup Unable to write progress log




I got a error when start the Oracle online backup.




01/01/2010 08:51:13 - Error bprd (pid=23176) Unable to write progress log </usr/openv/netbackup/logs/user_ops/dbext/logs/18624.0.1338271825> on client ora-ls. Policy=Oracle_online_backup Sched=NONE

01/01/2010 08:51:13 - Error bprd (pid=23176) CLIENT ora-ls POLICY Oracle_online_backup SCHED NONE EXIT STATUS 24 (socket write failed)




Solution:


I removed the logs from client and run the backup again..it was done successfully.

Sunday, May 27, 2012

Enable Archive Log Mode




SQL> conn sys/sy123@safi as sysdba

Connected.


SQL> create pfile from spfile;

File created.


SQL> alter system set log_archive_dest='/ora/archive1/' scope=spfile;

System altered.
 


SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.



SQL> startup mount

ORACLE instance started.

Total System Global Area 352321536 bytes

Fixed Size 2040600 bytes

Variable Size 234888424 bytes

Database Buffers 109051904 bytes

Redo Buffers 6340608 bytes

Database mounted.



SQL> alter database archivelog;

Database altered.



SQL> alter database open;

Database altered.


SQL> alter system switch logfile;

System altered.


SQL> select name, log_mode from v$database;

NAME      LOG_MODE
--------- ------------
SAFI      ARCHIVELOG

ORACLE RMAN Restore Database from Tape


Enivorment:

Solaris 10 Sparc 64-bit
Oracle DB 10.2.0
Veritas Netbackup Client
  1. Install Veritas Netbackup Client Software for Solaris.
  2. Install Veritas Netbackup Database Agent Software.
  3. Configure Netbackup New client on Master Server.
  4. Installed Oracle DB 10g software only.


Restore SPFILE from Tape


$ sqlplus /nolog

SQL*Plus: Release 10.2.0.4.0 - Production on Sun Dec 12 15:14:53 2010

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

SQL> conn / as sysdba

Connected to an idle instance.

SQL> startup nomount pfile='/ora/crs/oracle/product/10/app/dbs/dummypfile.ora' ;

ORACLE instance started.

Total System Global Area 893386752 bytes

Fixed Size 2044744 bytes

Variable Size 226495672 bytes

Database Buffers 658505728 bytes

Redo Buffers 6340608 bytes

SQL> exit

$ pwd

/ora/crs/oracle/product/10/app/dbs

$ rman target / nocatalog

Recovery Manager: Release 10.2.0.4.0 - Production on Sun Dec 12 15:18:30 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: sdb (not mounted)
using target database control file instead of recovery catalog

RMAN> set dbid=3389811866

executing command: SET DBID

NOTE: SPFILE TAG (c-3389811866-20101211-02)

Spfile data image tage u will get it through below command.


$cd /usr/openv/netbackup/bin

Below command show the images of control files.

$ ./bplist -C ora-rs -t 4 -l -R /


RMAN> run {

2> allocate channel ch00 type 'SBT_TAPE';
3> send 'NB_ORA_CLIENT=ora-rs';
4> restore spfile from 'c-3389811866-20101211-02';
5> release channel ch00;
6> }

allocated channel: ch00
channel ch00: sid=1986 devtype=SBT_TAPE

channel ch00: Veritas NetBackup for Oracle - Release 6.5 (2007072323)

sent command to channel: ch00

Starting restore at 12-DEC-10

channel ch00: autobackup found: c-3389811866-20101211-02

channel ch00: SPFILE restore from autobackup complete

Finished restore at 12-DEC-10

released channel: ch00

RMAN>exit

Monitor the restoring process through Veritas Netbackup GUI

# /usr/openv/java/jnbSA 


$cd /ora/crs/oracle/product/10/app/dbs

Create below directies.

adump
bdump
cdump
archive1
archive2
udump


$ vi spfilesdb.ora   (Change the below parameters)


audit_file_dest='/ora/app/oracle/admin/sdb/adump' (Created the directory adump)

background_dump_dest='/ora/app/oracle/admin/sdb/bdump' (Created the directory bdump)

core_dump_dest='/ora/app/oracle/admin/sdb/cdump' (Created the directory cdump)

log_archive_dest='/ora_dat/sdb/archive1' (Created the directory)

log_archive_duplex_dest='/ora_idx/sdb/archive2' (Created the directory)

user_dump_dest='/ora/app/oracle/admin/sdb/udump' (Directory Created)


$sqlplus /nolog

SQL> Connect / as sysdba

SQL> Startup nomount pfile='/ora/crs/oracle/product/10/app/dbs/spfilesdb.ora';


Control Files Restore from Tape

$cd /usr/openv/netbackup/bin
$ ./bplist -C ora-rs -t 4 -l -R /

$ rman target / nocatalog


RMAN> run {
2> allocate channel ch00 type 'sbt_tape';
3> send 'NB_ORA_CLIENT=ora-rs';
4> restore controlfile from 'cntrl_3235_1_716668933';
5> release channel ch00;
6> }



SQL> Startup mount pfile='/ora/crs/oracle/product/10/app/dbs/spfilesdb.ora';


Data Files Restore & Recover from Tape

$ rman target / nocatalog

RMAN> run {
2> allocate channel ch00 type 'sbt_tape';
3> send 'NB_ORA_CLIENT=ora-rs';
4> restore database;
5> recover database;
6> release channel ch00;
7> }


RMAN> alter database open resetlogs;















 




    

Saturday, May 26, 2012

Validate Oracle Backup from Tape




Purpose:



The main purpose of RMAN validation is to check for corrupt blocks and missing files. You can also use RMAN to determine whether backups can be restored. You can use the following RMAN commands to perform validation:


Oracle Spfile Backup Validate from Tape


$ rman target / catalog rman/rman123@catdb

Recovery Manager: Release 10.2.0.4.0 - Production on Mon Sep 6 12:39:12 2010

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

connected to target database: SSADB (DBID=3387211866)
connected to recovery catalog database

RMAN> list backup of spfile;

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
152286 Full 23.00M SBT_TAPE 00:01:04 05-SEP-10
BP Key: 152288 Status: AVAILABLE Compressed: NO Tag: TAG20100905T213
149
Handle: c-3389811866-20100905-02 Media: 0011L4
SPFILE Included: Modification time: 05-SEP-10

RMAN> run {
2> allocate channel ch001 type 'SBT_TAPE';
3> SEND 'NB_ORA_CLIENT=ora-rs';
4> validate backupset 152286;
5> }

allocated channel: ch001
channel ch001: sid=1720 devtype=SBT_TAPE
channel ch001: Veritas NetBackup for Oracle - Release 6.5 (2007072323)

sent command to channel: ch001

channel ch001: starting validation of datafile backupset
channel ch001: reading from backup piece c-3389811866-20100905-02
channel ch001: restored backup piece 1
piece handle=c-3389811866-20100905-02 tag=TAG20100905T213149
channel ch001: validation complete, elapsed time: 00:02:05
released channel: ch001


Validate Oracle Controlfile Backup from Tape


RMAN> list backup of controlfile;



BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
152272 Full 22.75M SBT_TAPE 00:01:01 05-SEP-10
BP Key: 152275 Status: AVAILABLE Compressed: NO Tag: TAG20100905T213
042
Handle: cntrl_5906_1_728947842 Media: 0011L4
Control File Included: Ckp SCN: 676569375 Ckp time: 05-SEP-10



BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
152286 Full 23.00M SBT_TAPE 00:01:04 05-SEP-10
BP Key: 152288 Status: AVAILABLE Compressed: NO Tag: TAG20100905T213
149
Handle: c-3389811866-20100905-02 Media: 0011L4
Control File Included: Ckp SCN: 676569420 Ckp time: 05-SEP-10



RMAN> run {
2> allocate channel ch001 type 'SBT_TAPE';
3> SEND 'NB_ORA_CLIENT=ora-rs';
4> validate backupset 152286;
5> }


Validate Oracle Datafile Backup from Tape


RMAN>list backup of database completed between '04-SEP-10' and '06-SEP-10';

RMAN>list backup of database completed after '01-SEP-10';

RMAN>list backup of database;

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
152119 Incr 0 22.43G SBT_TAPE 00:17:10 05-SEP-10
BP Key: 152129 Status: AVAILABLE Compressed: NO Tag: HOT_DB_BK_LEVEL
0
Handle: bk_5900_1_728946270 Media:
List of Datafiles in backup set 152119
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
2 0 Incr 676568348 05-SEP-10 /ora_dat/ssadb/undotbs01.dbf
4 0 Incr 676568348 05-SEP-10 /ora_dat/ssadb/users01.dbf
5 0 Incr 676568348 05-SEP-10 /ora_dat/ssadb/system02.dbf
30 0 Incr 676568348 05-SEP-10 /ora_idx/ssadb/idx_SSAERP13.dbf
31 0 Incr 676568348 05-SEP-10 /ora_idx/ssadb/idx_SSAERP14.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
152120 Incr 0 7.15G SBT_TAPE 00:10:59 05-SEP-10
BP Key: 152130 Status: AVAILABLE Compressed: NO Tag: HOT_DB_BK_LEVEL
0
Handle: bk_5901_1_728946836 Media:
List of Datafiles in backup set 152120
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 0 Incr 676568630 05-SEP-10 /ora_dat/ssadb/system01.dbf
3 0 Incr 676568630 05-SEP-10 /ora_dat/ssadb/sysaux01.dbf
32 0 Incr 676568630 05-SEP-10 /ora_idx/ssadb/idx_SSAERP15.dbf


RMAN> run {
2> allocate channel ch00 type 'SBT_TAPE';
3> send 'NB_ORA_CLIENT=ora-rs';
4> validate backupset 152120,151119;
5> release channel ch00;
6> }

allocated channel: ch00
channel ch00: sid=690 devtype=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 6.5 (2007072323)

sent command to channel: ch00

channel ch00: starting validation of datafile backupset
channel ch00: reading from backup piece bk_5886_1_728858000
channel ch00: restored backup piece 1
piece handle=bk_5886_1_728858000 tag=HOT_DB_BK_LEVEL0
channel ch00: validation complete, elapsed time: 00:08:48
channel ch00: starting validation of datafile backupset
channel ch00: reading from backup piece bk_5887_1_728858565
channel ch00: restored backup piece 1
piece handle=bk_5887_1_728858565 tag=HOT_DB_BK_LEVEL0
channel ch00: validation complete, elapsed time: 00:02:15

released channel: ch00


Validate Oracle Archive Log Files


RMAN> list backup of archivelog all completed after '05-SEP-10';


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

BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
152199 504.50M SBT_TAPE 00:01:09 05-SEP-10
BP Key: 152203 Status: AVAILABLE Compressed: NO Tag: TAG20100905T212
702
Handle: al_5903_1_728947623 Media:

List of Archived Logs in backup set 152199
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 20647 675468442 04-SEP-10 675618305 04-SEP-10
1 20648 675618305 04-SEP-10 675621933 04-SEP-10
1 20649 675621933 04-SEP-10 675787032 05-SEP-10
1 20650 675787032 05-SEP-10 675801972 05-SEP-10
1 20651 675801972 05-SEP-10 675950772 05-SEP-10
1 20652 675950772 05-SEP-10 675970688 05-SEP-10
1 20653 675970688 05-SEP-10 675990826 05-SEP-10
1 20654 675990826 05-SEP-10 676142884 05-SEP-10
1 20655 676142884 05-SEP-10 676161224 05-SEP-10
1 20656 676161224 05-SEP-10 676178891 05-SEP-10
1 20657 676178891 05-SEP-10 676195036 05-SEP-10

BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
152200 476.00M SBT_TAPE 00:02:10 05-SEP-10
BP Key: 152204 Status: AVAILABLE Compressed: NO Tag: TAG20100905T212
702
Handle: al_5904_1_728947623 Media:

List of Archived Logs in backup set 152200
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 20658 676195036 05-SEP-10 676217270 05-SEP-10
1 20659 676217270 05-SEP-10 676234683 05-SEP-10
1 20660 676234683 05-SEP-10 676254444 05-SEP-10
1 20661 676254444 05-SEP-10 676274108 05-SEP-10
1 20662 676274108 05-SEP-10 676291037 05-SEP-10
1 20663 676291037 05-SEP-10 676305509 05-SEP-10
1 20664 676305509 05-SEP-10 676322927 05-SEP-10
1 20665 676322927 05-SEP-10 676351397 05-SEP-10
1 20666 676351397 05-SEP-10 676526354 05-SEP-10
1 20667 676526354 05-SEP-10 676543636 05-SEP-10
1 20668 676543636 05-SEP-10 676569175 05-SEP-10
1 20669 676569175 05-SEP-10 676569211 05-SEP-10

BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
152499 687.25M SBT_TAPE 00:01:13 06-SEP-10
BP Key: 152503 Status: AVAILABLE Compressed: NO Tag: TAG20100906T212
801
Handle: al_5917_1_729034081 Media:

List of Archived Logs in backup set 152499
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 20670 676569211 05-SEP-10 676716175 05-SEP-10
1 20671 676716175 05-SEP-10 676724745 06-SEP-10
1 20672 676724745 06-SEP-10 676885284 06-SEP-10
1 20673 676885284 06-SEP-10 676905415 06-SEP-10
1 20674 676905415 06-SEP-10 676923094 06-SEP-10
1 20675 676923094 06-SEP-10 676942976 06-SEP-10
1 20676 676942976 06-SEP-10 677097830 06-SEP-10
1 20677 677097830 06-SEP-10 677247249 06-SEP-10
1 20678 677247249 06-SEP-10 677261164 06-SEP-10
1 20679 677261164 06-SEP-10 677277774 06-SEP-10
1 20680 677277774 06-SEP-10 677293510 06-SEP-10
1 20681 677293510 06-SEP-10 677310453 06-SEP-10
1 20682 677310453 06-SEP-10 677328878 06-SEP-10
1 20683 677328878 06-SEP-10 677347699 06-SEP-10
1 20684 677347699 06-SEP-10 677365452 06-SEP-10

BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
152500 671.25M SBT_TAPE 00:02:13 06-SEP-10
BP Key: 152504 Status: AVAILABLE Compressed: NO Tag: TAG20100906T212
801
Handle: al_5918_1_729034081 Media:

List of Archived Logs in backup set 152500
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 20685 677365452 06-SEP-10 677394448 06-SEP-10
1 20686 677394448 06-SEP-10 677409834 06-SEP-10
1 20687 677409834 06-SEP-10 677426170 06-SEP-10
1 20688 677426170 06-SEP-10 677440722 06-SEP-10
1 20689 677440722 06-SEP-10 677457081 06-SEP-10
1 20690 677457081 06-SEP-10 677470170 06-SEP-10
1 20691 677470170 06-SEP-10 677483727 06-SEP-10
1 20692 677483727 06-SEP-10 677496501 06-SEP-10
1 20693 677496501 06-SEP-10 677510607 06-SEP-10
1 20694 677510607 06-SEP-10 677522135 06-SEP-10
1 20695 677522135 06-SEP-10 677534305 06-SEP-10
1 20696 677534305 06-SEP-10 677549321 06-SEP-10
1 20697 677549321 06-SEP-10 677703740 06-SEP-10
1 20698 677703740 06-SEP-10 677717755 06-SEP-10
1 20699 677717755 06-SEP-10 677739134 06-SEP-10
1 20700 677739134 06-SEP-10 677739175 06-SEP-10

RMAN> run {
2> allocate channel ch00 type 'SBT_TAPE';
3> send 'NB_ORA_CLIENT=ora-rs';
4> validate backupset 152500;
5> release channel ch00;
6> }

allocated channel: ch00
channel ch00: sid=690 devtype=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 6.5 (2007072323)

sent command to channel: ch00

channel ch00: starting validation of archive log backupset
channel ch00: reading from backup piece al_5918_1_729034081
channel ch00: restored backup piece 1
piece handle=al_5918_1_729034081 tag=TAG20100906T212801
channel ch00: validation complete, elapsed time: 00:06:56

released channel: ch00




Configure Flashback Database




Configuring Flashback Database


The steps for configuring Flashback database option in  are:

Configure database to run in ARCHIVELOG mode.

Ensure the datbase is operating in ARCHIVELOG mode.


SQL> ARCHIVE LOG LIST

Database log mode            Archive Mode
Automatic archival              Enabled
Archive destination             /home/oracle/archiev1
Oldest online log sequence          5
Next log sequence to archive      7
Current log sequence                 7


If not, shutdown immediate, then startup mount, and alter the database

SQL> alter database archivelog;


Configure Flashbask when the instance in mount operating mode

SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP MOUNT
SQL> ALTER DATABASE FLASHBACK ON;

Database altered.


Configuring flashback database related parameters

SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST =
          '/home/oracle/flash_recover_area' scope=both;


SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 3G SCOPE=both;


SQL> ALTER SYSTEM SET DB_FLASHBACK_RENTENTION_TARGET = 4320 SCOPE=both;


SQL> show parameter DB_FLASH

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_flashback_retention_target        integer     4320


SQL> show parameter db_recovery_file

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /home/oracle/flash_recovery_area

db_recovery_file_dest_size           big integer 3G


Obtain SCN before initiating a database change.

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
     945046


Perform database change

SQL> drop table scott.salgrade;

Table dropped.


Performing  flashback database

SQL> shutdown immediate;

Database closed.
Database dismounted.
ORACLE instance shut down.


SQL> startup mount;

ORACLE instance started.
Total System Global Area  608174080 bytes
Fixed Size                  1281624 bytes
Variable Size             163578280 bytes
Database Buffers          436207616 bytes
Redo Buffers                7106560 bytes
Database mounted.



SQL> FLASHBACK DATABASE TO SCN 945046;

Flashback complete.

Open the Database with RESETLOGS.


SQL> alter database open resetlogs;

Database altered.

Confirm success of flashback.



SQL> select * from scott.salgrade;

     GRADE      LOSAL      HISAL
---------- ---------- ----------
         1             700          1200
         2             1201        1400
         3             1401        2000
         4             2001        3000
         5             3001        9999