Tuesday, October 14, 2014

Clear SBT_TAPE oracle

Configure Oracle Virtual TAPE DEVICE driver
==================================

CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS='SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/Path_to_backup)';


Exaple:
=======
- RMAN configure with SBT_TAPE devices

RMAN configuration parameters for database with db_unique_name MEIS are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oracle/products/11.2.0.2.0/db_1/dbs/snapcf_MEIS.f'; # default


- Configure SBT_TAPE DEVICE and Config CHANNEL to Virtual Disk (load oracle tape device drivers)

CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS='SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/Path_to_backup)';
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 8 BACKUP TYPE TO BACKUPSET;

- SHOW Backup and Copy Image

LIST BACKUP;
LIST COPY;

- Crosscheck Backup set for marking backup set to 'EXPIRED'

CROSSCHECK BACKUP;

- Delete expired backupset

DELETE EXPIRED BACKUP;


- Show Configuration

RMAN configuration parameters for database with db_unique_name NIDAREG are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 8 BACKUP TYPE TO BACKUPSET;
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 8 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  "SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/u03)";
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default


- Clear SBT_TAPE CHANNEL and DEVICE

CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' CLEAR;
CONFIGURE DEVICE TYPE 'SBT_TAPE' CLEAR;


- Crosscheck Backup

CROSSCHECK BACKUP;
DELETE EXPIRED BACKUP;

-Set Device
-Clear Chanel----> Device

Thursday, October 2, 2014

Multiplex ArchiveRedolog Using NFS on Solaris 10 x86

OS: Solaris 10 x86 by NFS file share
pri-db:10.100.101.101
stb-db:10.100.101.102

same env

NFS Server Setup Solaris 10 x86:
===============================

@stb-db

- check service nfs-server
stb-db# svcs network/nfs/server
STATE          STIME    FMRI
online         10:43:18 svc:/network/nfs/server:default

- create directory for share ( LOG_ARCHIVE_DEST_2 on pri-db)
mkdir -p /u02/share

- add to /etc/dfs/dfstab for sharing
stb-db# more dfstab

#       Place share(1M) commands here for automatic execution
#       on entering init state 3.
#
#       Issue the command 'svcadm enable network/nfs/server' to
#       run the NFS daemon processes and the share commands, after adding
#       the very first entry to this file.
#
#       share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
#       .e.g,
#       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2
share  -F nfs  -o rw=10.100.101.101 -d "archive dest 2"  /u02/share

allow client ip 10.100.101.101 to mount nfs file server

- enable share

stb-db# shareall
stb-db# share
-               /u02/share   rw=10.100.101.101   "archive dest 2"
stb-db#

@pri-db

- create mount point

mkdir -p /u02/ext-arc

- mount NFS

stb-db# mount -F nfs -o rw,bg,hard,nointr,rsize=32768,wsize=32768,actimeo=0,vers=3,timeo=600 10.100.101.102:/u02/share /u02/ext-arc  ; option for mount "binary file" in oracle

stb-db# mount -F nfs -o rw,bg,hard,nointr,rsize=32768,wsize=32768,proto=tcp,noac,forcedirectio,vers=3,suid 10.100.101.102:/u02/share /u02/ext-arc  ; option for mount "data file" in oracle

- /etc/mnttab
pri-db# more /etc/mnttab
/dev/dsk/c1t0d0s0       /       ufs     rw,intr,largefiles,logging,xattr,onerror=panic,dev=840000       1412215268
/devices        /devices        devfs   dev=4c00000     1412215258
ctfs    /system/contract        ctfs    dev=4c80001     1412215258
proc    /proc   proc    dev=4c40000     1412215258
mnttab  /etc/mnttab     mntfs   dev=4cc0001     1412215258
swap    /etc/svc/volatile       tmpfs   xattr,dev=4d00001       1412215258
objfs   /system/object  objfs   dev=4d40001     1412215258
sharefs /etc/dfs/sharetab       sharefs dev=4d80001     1412215258
/usr/lib/libc/libc_hwcap1.so.1  /lib/libc.so.1  lofs    dev=840000      1412215266
fd      /dev/fd fd      rw,dev=4f00001  1412215268
swap    /tmp    tmpfs   xattr,dev=4d00002       1412215274
swap    /var/run        tmpfs   xattr,dev=4d00003       1412215274
/dev/dsk/c1t0d0s7       /export/home    ufs     rw,intr,largefiles,logging,xattr,onerror=panic,dev=840007       1412215275
zhome/u01       /u01    zfs     rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime,dev=2d50002        1412215276
zdata/u02       /u02    zfs     rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime,dev=2d50003        1412215276
zdata   /zdata  zfs     rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime,dev=2d50004        1412215276
zhome   /zhome  zfs     rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime,dev=2d50005        1412215276
-hosts  /net    autofs  nosuid,indirect,ignore,nobrowse,dev=4fc0001     1412215280
auto_home       /home   autofs  indirect,ignore,nobrowse,dev=4fc0002    1412215280
pri-db:vold(pid554)     /vol    nfs     ignore,noquota,dev=4f80001      1412215280
10.100.101.102:/u02/share       /u02/ext-arc    nfs     rw,bg,hard,nointr,rsize=32768,wsize=32768,actimeo=0,vers=3,timeo=600,xattr,dev=4f80005  1412225176





CLONE TO STB
============
@pri-db
:create pfile
=============
SQL> create pfile='/export/home/oracle/pfile.ora' from spfile;


(ORCL) /u01/oracle/product/11.2.0.2/dbhome_1/dbs $ more initORCL.ora
ORCL.__db_cache_size=264241152
ORCL.__java_pool_size=4194304
ORCL.__large_pool_size=4194304
ORCL.__oracle_base='/u01/oracle'#ORACLE_BASE set from environment
ORCL.__pga_aggregate_target=373293056
ORCL.__sga_target=700448768
ORCL.__shared_io_pool_size=0
ORCL.__shared_pool_size=411041792
ORCL.__streams_pool_size=4194304
*.audit_file_dest='/u01/oracle/admin/ORCL/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u02/ORCL/control01.ctl','/u01/oracle/fast_recovery_area/ORCL/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='ORCL'
*.db_recovery_file_dest='/u01/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=5368709120
*.diagnostic_dest='/u01/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
*.log_archive_dest_2='LOCATION=/u02/arc2'
*.log_archive_format='arc_%t_%s_%r.arc'
*.memory_target=1073741824
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'


:ADD LOG_ARCHIVE_DEST_2 to NFS mount path (/u02/ext-arc)
@ORCL connect as sysdba

alter system set log_archive_dest_1 = 'LOCATION=USE_DB_RECOVERY_FILE_DEST';
alter system set log_archive_dest_2 = 'LOCATION=/u02/ext-arc';

- Flush Archive log
alter system archive log current;  3 time (redolog group)


RMAN BACKUP script; catalog dest = /u01/backup

(ORCL) /export/home/oracle/script $ more rmanbackup.script
RUN {
ALLOCATE CHANNEL ch00 TYPE DISK;
ALLOCATE CHANNEL ch01 TYPE DISK;
ALLOCATE CHANNEL ch02 TYPE DISK;
ALLOCATE CHANNEL ch03 TYPE DISK;

BACKUP
    TAG ORCL_DB_BACKUP
    FORMAT '/u01/backup/ORCL_%s_%p_%t'
    DATABASE;
    sql 'alter system archive log current';
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
RELEASE CHANNEL ch02;
RELEASE CHANNEL ch03;

ALLOCATE CHANNEL ch00 TYPE DISK;
ALLOCATE CHANNEL ch01 TYPE DISK;

BACKUP
   TAG ARCHIVELOG_BACKUP
   FORMAT '/u01/backup/arc_ORCL_%s_%p_%t'
   ARCHIVELOG ALL DELETE INPUT;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;

ALLOCATE CHANNEL ch00 TYPE DISK;
BACKUP
    TAG CONTROLFILE_BACKUP
    FORMAT '/u01/backup/cntrl_%s_%p_%t'
    CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}
EXIT;


COPY Backupset to stb-db:

(ORCL) /u01/backup $ ls -rtl
total 3222869
-rw-r-----   1 oracle   oinstall 9895936 Oct  2 11:49 ORCL_49_1_859895276
-rw-r-----   1 oracle   oinstall 624304128 Oct  2 11:49 ORCL_47_1_859895275
-rw-r-----   1 oracle   oinstall   98304 Oct  2 11:49 ORCL_50_1_859895388
-rw-r-----   1 oracle   oinstall 75309056 Oct  2 11:49 ORCL_48_1_859895275
-rw-r-----   1 oracle   oinstall 928931840 Oct  2 11:50 ORCL_46_1_859895275
-rw-r-----   1 oracle   oinstall   55296 Oct  2 11:50 arc_ORCL_51_1_859895426
-rw-r-----   1 oracle   oinstall    2560 Oct  2 11:50 arc_ORCL_52_1_859895426
-rw-r-----   1 oracle   oinstall 9895936 Oct  2 11:50 cntrl_53_1_859895428

(ORCL) /u01/backup $ scp * oracle@10.100.101.102:/u01/backup

(ORCL) /export/home/oracle $ scp pfile.ora oracle@10.100.101.102:/u01/backup


========================================================================================================================================



@stb-db
=======

create OS env:

- .bash_profile
#!/bin/bash
export PS1='($ORACLE_SID) $PWD $ '
export ORACLE_BASE=/u01/oracle
export ORACLE_OWNER=oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.2/dbhome_1
export PATH=$PATH:/usr/openwin/bin:$ORACLE_HOME/bin:/usr/sbin:/usr/bin
export ORACLE_SID=ORCL

- create directory for oracle datafile, fast recovery are, audit path;

RMAN> report schema;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name ORCL

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    730      SYSTEM               ***     /u02/test/system01.dbf
2    770      SYSAUX               ***     /u02/ORCL/sysaux01.dbf
3    360      UNDOTBS1             ***     /u02/ORCL/undotbs01.dbf
4    450      USERS                ***     /u02/ORCL/users01.dbf
5    345      EXAMPLE              ***     /u02/test/exp.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u02/ORCL/temp01.dbf

RMAN>

mkdir -p /u02/test/
mkdir -p /u02/ORCL/
mkdir -p /u01/oracle/admin/ORCL/adump    <-----------audit path
mkdir -p /u01/oracle/fast_recovery_area    <-----------fast_recovery_area


- add project

(ORCL) /export/home/oracle $ more /etc/project
system:0::::
user.root:1::::
noproject:2::::
default:3::::
group.staff:10::::
user.oracle:100::oracle::project.max-shm-memory=(priv,4294967295,deny)

Check ORACLE env:

ORACLE_BASE=/u01/oracle
ORACLE_OWNER=oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0.2/dbhome_1



RECOVERY:
=========

- start with pfile
SQL> startup pfile='/export/home/oracle/pfile.ora' nomount;

- create spfile
SQL> create spfile from pfile='/export/home/oracle/pfile.ora';

- restart database and startup nomount
SQL> shutdown immediate
SQL> startup nomount

SQL> startup nomount
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2230968 bytes
Variable Size             796919112 bytes
Database Buffers          264241152 bytes
Redo Buffers                5545984 bytes
SQL>


- connect to RMAN restore controlfile from backupset

(ORCL) /u01/backup $ rman target /

Recovery Manager: Release 11.2.0.2.0 - Production on Thu Oct 2 16:16:33 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (not mounted)

RMAN> restore controlfile from '/u01/backup/cntrl_53_1_859895428';

Starting restore at 02-OCT-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u02/ORCL/control01.ctl
output file name=/u01/oracle/fast_recovery_area/ORCL/control02.ctl
Finished restore at 02-OCT-14

RMAN>

- mount datafile

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN>


-check LOG_ARCHIVE_DEST_2 and set log archive destination to /u02/share (NFS share path)


SQL> show parameter log

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
audit_syslog_level                   string
commit_logging                       string
db_create_online_log_dest_1          string
db_create_online_log_dest_2          string
db_create_online_log_dest_3          string
db_create_online_log_dest_4          string
db_create_online_log_dest_5          string
enable_ddl_logging                   boolean     FALSE
log_archive_config                   string
log_archive_dest                     string
log_archive_dest_1                   string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_10                  string
log_archive_dest_11                  string
log_archive_dest_12                  string
log_archive_dest_13                  string
log_archive_dest_14                  string
log_archive_dest_15                  string
log_archive_dest_16                  string
log_archive_dest_17                  string
log_archive_dest_18                  string
log_archive_dest_19                  string
log_archive_dest_2                   string      LOCATION=/u02/share

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_20                  string
log_archive_dest_21                  string
log_archive_dest_22                  string
log_archive_dest_23                  string
log_archive_dest_24                  string
log_archive_dest_25                  string
log_archive_dest_26                  string
log_archive_dest_27                  string
log_archive_dest_28                  string
log_archive_dest_29                  string
log_archive_dest_3                   string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_30                  string
log_archive_dest_31                  string
log_archive_dest_4                   string
log_archive_dest_5                   string
log_archive_dest_6                   string
log_archive_dest_7                   string
log_archive_dest_8                   string
log_archive_dest_9                   string
log_archive_dest_state_1             string      enable
log_archive_dest_state_10            string      enable
log_archive_dest_state_11            string      enable

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_12            string      enable
log_archive_dest_state_13            string      enable
log_archive_dest_state_14            string      enable
log_archive_dest_state_15            string      enable
log_archive_dest_state_16            string      enable
log_archive_dest_state_17            string      enable
log_archive_dest_state_18            string      enable
log_archive_dest_state_19            string      enable
log_archive_dest_state_2             string      enable
log_archive_dest_state_20            string      enable
log_archive_dest_state_21            string      enable

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_22            string      enable
log_archive_dest_state_23            string      enable
log_archive_dest_state_24            string      enable
log_archive_dest_state_25            string      enable
log_archive_dest_state_26            string      enable
log_archive_dest_state_27            string      enable
log_archive_dest_state_28            string      enable
log_archive_dest_state_29            string      enable
log_archive_dest_state_3             string      enable
log_archive_dest_state_30            string      enable
log_archive_dest_state_31            string      enable

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_4             string      enable
log_archive_dest_state_5             string      enable
log_archive_dest_state_6             string      enable
log_archive_dest_state_7             string      enable
log_archive_dest_state_8             string      enable
log_archive_dest_state_9             string      enable
log_archive_duplex_dest              string
log_archive_format                   string      arc_%t_%s_%r.arc
log_archive_local_first              boolean     TRUE
log_archive_max_processes            integer     4
log_archive_min_succeed_dest         integer     1

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_start                    boolean     FALSE
log_archive_trace                    integer     0
log_buffer                           integer     5275648
log_checkpoint_interval              integer     0
log_checkpoint_timeout               integer     1800
log_checkpoints_to_alert             boolean     FALSE
log_file_name_convert                string
remote_login_passwordfile            string      EXCLUSIVE
sec_case_sensitive_logon             boolean     TRUE
sec_max_failed_login_attempts        integer     10
SQL>


SQL> alter system set log_archive_dest_2 = 'LOCATION=/u02/share'; <---------- set LOG ARCHIVE DEST

- restart DATABASE and startup mount

SQL> shut immediate
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2230968 bytes
Variable Size             796919112 bytes
Database Buffers          264241152 bytes
Redo Buffers                5545984 bytes
Database mounted.
SQL>


- catalog backup set

(ORCL) /u01/backup $ rman target /

Recovery Manager: Release 11.2.0.2.0 - Production on Thu Oct 2 16:27:08 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1378426121, not open)

RMAN> catalog start with '/u01/backup';

Starting implicit crosscheck backup at 02-OCT-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
Crosschecked 7 objects
Finished implicit crosscheck backup at 02-OCT-14

Starting implicit crosscheck copy at 02-OCT-14
using channel ORA_DISK_1
Crosschecked 3 objects
Finished implicit crosscheck copy at 02-OCT-14

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/oracle/fast_recovery_area/ORCL/autobackup/2014_10_02/o1_mf_s_859890781_b2skvftz_.bkp
File Name: /u01/oracle/fast_recovery_area/ORCL/autobackup/2014_10_02/o1_mf_s_859889245_b2sjcg4f_.bkp

searching for all files that match the pattern /u01/backup

List of Files Unknown to the Database
=====================================
File Name: /u01/backup/cntrl_53_1_859895428

Do you really want to catalog the above files (enter YES or NO)? Y
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/backup/cntrl_53_1_859895428

RMAN>

- restore database(datafile);

RMAN> restore database;

Starting restore at 02-OCT-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00002 to /u02/ORCL/sysaux01.dbf
channel ORA_DISK_1: reading from backup piece /u01/backup/ORCL_47_1_859895275
channel ORA_DISK_1: piece handle=/u01/backup/ORCL_47_1_859895275 tag=ORCL_DB_BACKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00003 to /u02/ORCL/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u02/test/exp.dbf
channel ORA_DISK_1: reading from backup piece /u01/backup/ORCL_48_1_859895275
channel ORA_DISK_1: piece handle=/u01/backup/ORCL_48_1_859895275 tag=ORCL_DB_BACKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u02/test/system01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u02/ORCL/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/backup/ORCL_46_1_859895275
channel ORA_DISK_1: piece handle=/u01/backup/ORCL_46_1_859895275 tag=ORCL_DB_BACKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 02-OCT-14

RMAN>

- recover database; apply transection log from archive log

RMAN> recover database;

Starting recover at 02-OCT-14
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=159
channel ORA_DISK_1: reading from backup piece /u01/backup/arc_ORCL_51_1_859895426
channel ORA_DISK_1: piece handle=/u01/backup/arc_ORCL_51_1_859895426 tag=ARCHIVELOG_BACKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u02/share/arc_1_159_850645387.arc thread=1 sequence=159
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=160
channel ORA_DISK_1: reading from backup piece /u01/backup/arc_ORCL_52_1_859895426
channel ORA_DISK_1: piece handle=/u01/backup/arc_ORCL_52_1_859895426 tag=ARCHIVELOG_BACKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u02/share/arc_1_160_850645387.arc thread=1 sequence=160
archived log file name=/u02/share/arc_1_161_850645387.arc thread=1 sequence=161
archived log file name=/u02/share/arc_1_162_850645387.arc thread=1 sequence=162
archived log file name=/u02/share/arc_1_163_850645387.arc thread=1 sequence=163
archived log file name=/u02/share/arc_1_164_850645387.arc thread=1 sequence=164
archived log file name=/u02/share/arc_1_165_850645387.arc thread=1 sequence=165
archived log file name=/u02/share/arc_1_166_850645387.arc thread=1 sequence=166
archived log file name=/u02/share/arc_1_167_850645387.arc thread=1 sequence=167 <----------------------------------------- last change#
unable to find archived log
archived log thread=1 sequence=168
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 10/02/2014 16:31:46
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 168 and starting SCN of 4393749

RMAN>

(ORCL) /u01/backup $ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Thu Oct 2 16:32:43 2014

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u02/share
Oldest online log sequence     159
Next log sequence to archive   161
Current log sequence           161<------------------------------------------------------------------------------------------- first change#
SQL>

note: RMAN applied transection log no.161 to log no.167 from archive log

- open database resetlogs

SQL> alter database open resetlogs;

Database altered.

SQL

note: database must open resetlogs b'coz datafile inconsistent (datafile , redolog, controlfile, archivelog)


- LOG will be reset

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u02/share
Oldest online log sequence     1
Next log sequence to archive   1
Current log sequence           1
SQL>


Check data:
==========
@stb-db

(ORCL) /u01/backup $ sqlplus aaa

SQL*Plus: Release 11.2.0.2.0 Production on Thu Oct 2 16:39:10 2014

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

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select * from tab;

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
A                              TABLE
B                              TABLE
C                              TABLE
D                              TABLE
E                              TABLE

SQL> select count(*) from E;

  COUNT(*)
----------
   1170304

SQL>

@pri-db

(ORCL) /export/home/oracle $ sqlplus aaa

SQL*Plus: Release 11.2.0.2.0 Production on Thu Oct 2 16:42:57 2014

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

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
SQL>
SQL> select * from tab;

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
A                              TABLE
B                              TABLE
C                              TABLE
D                              TABLE
E                              TABLE

SQL> select count(*) from E;

  COUNT(*)
----------
   1170304

SQL>




ref:http://solaris10commands.blogspot.com/2010/09/configuring-network-file-system-in.html









Friday, September 26, 2014

Oracle Switch datafile example

RMAN> report schema;

Report of database schema for database with db_unique_name DW

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    1250     SYSTEM               ***     /u01/app/oracle/oradata/dw/system01.dbf
2    860      SYSAUX               ***     /u01/app/oracle/oradata/dw/sysaux01.dbf
3    470      UNDOTBS1             ***     /u01/app/oracle/oradata/dw/undotbs01.dbf
4    861      USERS                ***     /u02/oradata/dw/USERS.dbf
5    100      EXAMPLE              ***     /u02/oradata/dw/EXAMPLE.dbf
6    10       FLOW_1               ***     /u02/oradata/dw/FLOW_1.dbf
7    250      FLOW_2               ***     /u01/app/oracle/oradata/dw/FLOW_2.dbf
8    250      FLOW_3               ***     /u02/oradata/dw/FLOW_3.dbf
9    1024     DM                   ***     /u02/oradata/dw/DM.dbf
10   20       DM_ARCHIVE           ***     /u02/oradata/dw/DM_ARCHIVE.dbf
11   556      APEX                 ***     /u02/oradata/dw/APEX.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    384      TEMP                 32767       /u01/app/oracle/oradata/dw/temp01.dbf

change datafile to

/u02/oradata/dw

sql 'ALTER TABLESPACE FLOW_2 OFFLINE';

COPY DATAFILE 7 TO '/u02/oradata/dw/FLOW_2.dbf';

SWITCH DATAFILE 7 TO COPY;

recover tablespace FLOW_2;

sql 'ALTER TABLESPACE USERS ONLINE';

*rman backup as copy before switch datafile ( image copy )

backup as copy datafile x format 'new_location_of_datafile';


Examples
RMAN> LIST ARCHIVELOG ALL;
RMAN> LIST BACKUP OF ARCHIVELOG ALL;
RMAN> LIST BACKUP;
RMAN> LIST BACKUP OF DATABASE;
RMAN> LIST BACKUP OF DATAFILE 1;
RMAN> LIST BACKUP SUMMARY;
RMAN> LIST INCARNATION;
RMAN> LIST BACKUP BY FILE;
RMAN> LIST COPY OF DATABASE ARCHIVELOG ALL;
RMAN> LIST COPY OF DATAFILE 1, 2, 3;
RMAN> LIST BACKUP OF DATAFILE 11 SUMMARY;
RMAN> LIST BACKUP OF ARCHIVELOG FROM SEQUENCE 1437;
RMAN> LIST CONTROLFILECOPY "/tmp/cntrlfile.copy";
RMAN> LIST BACKUPSET OF DATAFILE 1;
RMAN> LIST FAILURE;
RMAN> LIST FAILURE 641231 detail;

Saturday, September 13, 2014

Cyrus-imapd error no mailbox

exp:
===
error: could not complete request. query: select "inbox" reason given: mailbox does not exist  
or
error: could not complete request. query: create "inbox/sent" reason given: permission denied

imapd.conf configuration
=============
[root@Grads etc]# vi imapd.conf
configdirectory: /var/lib/imap
partition-default: /var/spool/imap
admins: cyrus root <------------------- add root as cyrus admin
sievedir: /var/lib/imap/sieve
sendmail: /usr/sbin/sendmail
hashimapspool: true
sasl_pwcheck_method: saslauthd
sasl_mech_list: PLAIN
tls_cert_file: /etc/pki/cyrus-imapd/cyrus-imapd.pem
tls_key_file: /etc/pki/cyrus-imapd/cyrus-imapd.pem
tls_ca_file: /etc/pki/tls/certs/ca-bundle.crt
unixhierarchysep: yes

restart services
==========
service cyrus-imapd stop
service cyrus-imapd start

[root@Grads etc]# cyradm -u root localhost
localhost.localdomain> cm user/wilailak.1
localhost.localdomain> cm user/warut.ing
localhost.localdomain> lm user/wilailak.1
user/wilailak.1 (\HasChildren)
localhost.localdomain> lm user/warut.ing
user/warut.ing (\HasNoChildren)

ref:
http://oreilly.com/catalog/mimap/chapter/ch09.html
http://doc.norang.ca/cyrus-imap-server.html


Monday, September 8, 2014

Solaris 10 Date, Time

Manual Setting
===========
#date “month day hour minute year”
# date 1201010106
Fri Dec  1 01:01:00 PST 2006

sync with time server
===============
#ntpdate xxx.xxx.xxx.xxx

Monday, August 25, 2014

ESXi 5.5 vib install (driver on ESXi)

esxcli system module list

esxcli software vib install -v  <path-drivername>

esxcli software vib install -v /tmp/Brocade_bootbank_scsi-bfa_3.2.4.0-1OEM.500.0.0.472560.vib


#remove

# esxcli software vib remove -n vendor vib name -f

Check Driver Version
================
 ethtool -i vmnic9

Disable NIC  fcoe
==============
Esxcli fcoe nic disable -n=vmnic8

ipv6

netsh interface ipv6 set privacy state=disabled store=active
netsh interface ipv6 set privacy state=disabled store=persistent
netsh interface ipv6 set global randomizeidentifiers=disabled store=active
netsh interface ipv6 set global randomizeidentifiers=disabled store=persistent

ALCATEL 6900

write memory copy running certified reload from working no rollback-timeout