Wednesday, May 29, 2013

Check DML progress

SELECT SUBSTR(sql_text, 1, 60) "SQL Text",
       rows_processed "Total Rows Processed",
       ROUND((SYSDATE - TO_DATE(first_load_time, 'yyyy-mm-dd hh24:mi:ss')) * 24 * 60, 1) "Total Time (Min)",
       TRUNC(rows_processed /((SYSDATE - TO_DATE(first_load_time, 'yyyy-mm-dd hh24:mi:ss')) * 24 * 60)) "Rows/Min",
       TRUNC(rows_processed /((SYSDATE - TO_DATE(first_load_time, 'yyyy-mm-dd hh24:mi:ss')) * 24 * 60 * 60)) "Rows/Sec"
  FROM SYS.v_$sqlarea
 WHERE sql_text LIKE 'MERGE%'
   AND open_versions > 0
   AND rows_processed > 0;

Tuesday, May 28, 2013

ORA-19694: some changed blocks were not found in the change tracking file



RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 05/28/2013 0


Disable block change tracking:

SQL> select * from v$block_change_tracking;

STATUS
----------
FILENAME
--------------------------------------------------------------------------------
     BYTES
----------
ENABLED
/u01/oradata/PPC/block_change_tracking.f
  11599872


SQL> alter database disable block change tracking;

Database altered.

SQL> select * from v$block_change_tracking;

STATUS
----------
FILENAME
--------------------------------------------------------------------------------
     BYTES
----------
DISABLED


Monday, May 27, 2013

Errno: 1590 - The incident LOST_EVENTS occured on the master. Message: error writing to the binary log


mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.120.251.21
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000009
          Read_Master_Log_Pos: 120
               Relay_Log_File: relay-bin.000019
                Relay_Log_Pos: 283
        Relay_Master_Log_File: mysql-bin.000008
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 1590
                   Last_Error: The incident LOST_EVENTS occured on the master. Message: error writing to the binary log
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 120
              Relay_Log_Space: 1758
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 1590
               Last_SQL_Error: The incident LOST_EVENTS occured on the master. Message: error writing to the binary log
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1
                  Master_UUID: 55f6585c-bd69-11e2-90a5-ac162d8b1c44
             Master_Info_File: /var/lib/mysql/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State:
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp: 130527 19:56:53
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set:
            Executed_Gtid_Set:
                Auto_Position: 0
1 row in set (0.00 sec)

mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.120.251.21
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000009
          Read_Master_Log_Pos: 120
               Relay_Log_File: relay-bin.000023
                Relay_Log_Pos: 283
        Relay_Master_Log_File: mysql-bin.000009
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 120
              Relay_Log_Space: 613
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1
                  Master_UUID: 55f6585c-bd69-11e2-90a5-ac162d8b1c44
             Master_Info_File: /var/lib/mysql/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp:
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set:
            Executed_Gtid_Set:
                Auto_Position: 0
1 row in set (0.00 sec)

Friday, May 17, 2013

ORA-25153 Temporary Tablespace is Empty


ORA-25153:

Temporary Tablespace is Empty
Cause:An attempt was made to use space in a temporary tablespace with no files.
Action:Add files to the tablespace using ADD TEMPFILE command.


SQL> select tablespace_name from dba_tablespaces where contents='TEMPORARY';

TEMP

SQL> select file_name from dba_temp_files where tablespace_name='TEMP';

no rows selected

SQL> ALTER TABLESPACE TEMP add tempfile '/u02/app/oracle/oradata/tetris11/temp01.dbf' size 100M reuse;

Tablespace altered.

SQL> select file_name from dba_temp_files where tablespace_name='TEMP';

/u02/app/oracle/oradata/tetris11/temp01.dbf

ORA-00600: internal error code, arguments: [kcratr_nab_less_than_odr], [1], [12091], [76121], [76123], [], [], [], [], [], [], []


Start database after force shutdown (server power off)


$ sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Fri May 17 14:01:59 2013

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

SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2232840 bytes
Variable Size             826281464 bytes
Database Buffers          234881024 bytes
Redo Buffers                5541888 bytes
Database mounted.
ORA-00600: internal error code, arguments: [kcratr_nab_less_than_odr], [1],
[12091], [76121], [76123], [], [], [], [], [], [], []


SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> exit


Check control file location


$ sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Fri May 17 14:05:04 2013

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

SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2232840 bytes
Variable Size             834670072 bytes
Database Buffers          226492416 bytes
Redo Buffers                5541888 bytes
Database mounted.
SQL> show parameter control;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      /u02/app/oracle/oradata/tetris
                                                 11/control01.ctl, /u02/app/ora
                                                 cle/fast_recovery_area/tetris1
                                                 1/control02.ctl
control_management_pack_access       string      DIAGNOSTIC+TUNING
SQL> select a.member,a.group#,b.status from v$logfile a ,v$log b where a.group#=b.group# and b.status='CURRENT';

MEMBER
--------------------------------------------------------------------------------
    GROUP# STATUS
---------- ----------------
/u02/app/oracle/oradata/tetris11/redo01.log
         1 CURRENT

/u02/app/oracle/oradata/redo/redo01_2.log
         1 CURRENT


SQL> exit

Check backups


$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Fri May 17 14:06:51 2013

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

connected to target database: TETRIS11 (DBID=3526243642, not open)


RMAN> list backup summary;

using target database control file instead of recovery catalog

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
1578    B  0  A DISK        10-DEC-12       1       1       YES        BACKUP_TETRIS11_00_121012020001
1581    B  F  A DISK        10-DEC-12       1       1       NO         TAG20121210T020301
1582    B  0  A DISK        11-DEC-12       1       1       YES        BACKUP_TETRIS11_FU_121112013009
1583    B  F  A DISK        11-DEC-12       1       1       NO         TAG20121211T013246
1584    B  0  A DISK        11-DEC-12       1       1       YES        BACKUP_TETRIS11_00_121112020001
1585    B  F  A DISK        11-DEC-12       1       1       NO         TAG20121211T020309
1586    B  F  A DISK        11-DEC-12       1       1       YES        BACKUP_TETRIS11_00_121112020001
1587    B  F  A DISK        11-DEC-12       1       1       NO         TAG20121211T020315

RMAN> exit

Create controlfile to trace


bash-3.2$ sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Fri May 17 14:34:02 2013

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

SQL> conn / as sysdba
Connected.
SQL> show parameter control;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      /u02/app/oracle/oradata/tetris
                                                 11/control01.ctl, /u02/app/ora
                                                 cle/fast_recovery_area/tetris1
                                                 1/control02.ctl
control_management_pack_access       string      DIAGNOSTIC+TUNING
SQL>
SQL>
SQL> oradebug setmypid;
Statement processed.
SQL> Alter session set tracefile_identifier='controlfilerecreate' ;

Session altered.

SQL> Alter database backup controlfile to trace ;

Database altered.

SQL> Oradebug tracefile_name ;
/u02/app/oracle/diag/rdbms/tetris11/tetris11/trace/tetris11_ora_1158_controlfilerecreate.trc
SQL> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> exit





bash-3.2$ more tetris11_ora_1158_controlfilerecreate.trc
Trace file /u02/app/oracle/diag/rdbms/tetris11/tetris11/trace/tetris11_ora_1158_controlfilerecreate.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /u02/app/oracle/product/11.2.0/dbhome_1
System name:    SunOS
Node name:      b11scp2
Release:        5.10
Version:        Generic_147441-01
Machine:        i86pc
Instance name: tetris11
Redo thread mounted by this instance: 1
Oracle process number: 19
Unix process pid: 1158, image: oracle@b11scp2 (TNS V1-V3)


*** 2013-05-17 14:41:13.213
*** SESSION ID:(387.53) 2013-05-17 14:41:13.213
*** CLIENT ID:() 2013-05-17 14:41:13.213
*** SERVICE NAME:() 2013-05-17 14:41:13.213
*** MODULE NAME:(sqlplus@b11scp2 (TNS V1-V3)) 2013-05-17 14:41:13.213
*** ACTION NAME:() 2013-05-17 14:41:13.213


*** TRACE CONTINUED FROM FILE /u02/app/oracle/diag/rdbms/tetris11/tetris11/trace/tetris11_ora_1158.trc ***


*** 2013-05-17 14:41:13.212
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="tetris11"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=4
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE
--
-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
--     Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TETRIS11" NORESETLOGS  NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 9344
LOGFILE
  GROUP 1 (
    '/u02/app/oracle/oradata/tetris11/redo01.log',
    '/u02/app/oracle/oradata/redo/redo01_2.log'
  ) SIZE 50M BLOCKSIZE 512,
  GROUP 2 (
    '/u02/app/oracle/oradata/tetris11/redo02.log',
    '/u02/app/oracle/oradata/redo/redo02_2.log'
  ) SIZE 50M BLOCKSIZE 512,
  GROUP 3 (
    '/u02/app/oracle/oradata/tetris11/redo03.log',
    '/u02/app/oracle/oradata/redo/redo03_2.log'
  ) SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '/u02/app/oracle/oradata/tetris11/system01.dbf',
  '/u02/app/oracle/oradata/tetris11/sysaux01.dbf',
  '/u02/app/oracle/oradata/tetris11/undotbs01.dbf',
  '/u02/app/oracle/oradata/tetris11/users01.dbf',
  '/u02/app/oracle/oradata/tetris11/tab01',
  '/u02/app/oracle/oradata/tetris11/idx01',
  '/u02/app/oracle/oradata/tetris11/TIGOTBS_01.DBF',
  '/u02/app/oracle/oradata/tetris11/TIGOIDX_01.DBF',
  '/u02/app/oracle/oradata/tetris11/BNA01.DBF',
  '/u02/app/oracle/oradata/tetris11/TMPTBS.DBF'
CHARACTER SET WE8ISO8859P1
;
-- Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','ON');
-- Configure RMAN configuration record 2
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('BACKUP OPTIMIZATION','ON');
-- Configure RMAN configuration record 3
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('RETENTION POLICY','TO REDUNDANCY 2');
-- Configure RMAN configuration record 4
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1');
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u02/app/oracle/fast_recovery_area/TETRIS11/archivelog/2013_05_17/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u02/app/oracle/fast_recovery_area/TETRIS11/archivelog/2013_05_17/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u02/app/oracle/fast_recovery_area/TETRIS11/archivelog/2013_05_17/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/app/oracle/oradata/tetris11/temp01.dbf' REUSE;
-- End of tempfile additions.
--
--     Set #2. RESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TETRIS11" RESETLOGS  NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 9344
LOGFILE
  GROUP 1 (
    '/u02/app/oracle/oradata/tetris11/redo01.log',
    '/u02/app/oracle/oradata/redo/redo01_2.log'
  ) SIZE 50M BLOCKSIZE 512,
  GROUP 2 (
    '/u02/app/oracle/oradata/tetris11/redo02.log',
    '/u02/app/oracle/oradata/redo/redo02_2.log'
  ) SIZE 50M BLOCKSIZE 512,
  GROUP 3 (
    '/u02/app/oracle/oradata/tetris11/redo03.log',
    '/u02/app/oracle/oradata/redo/redo03_2.log'
  ) SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '/u02/app/oracle/oradata/tetris11/system01.dbf',
  '/u02/app/oracle/oradata/tetris11/sysaux01.dbf',
  '/u02/app/oracle/oradata/tetris11/undotbs01.dbf',
  '/u02/app/oracle/oradata/tetris11/users01.dbf',
  '/u02/app/oracle/oradata/tetris11/tab01',
  '/u02/app/oracle/oradata/tetris11/idx01',
  '/u02/app/oracle/oradata/tetris11/TIGOTBS_01.DBF',
  '/u02/app/oracle/oradata/tetris11/TIGOIDX_01.DBF',
  '/u02/app/oracle/oradata/tetris11/BNA01.DBF',
  '/u02/app/oracle/oradata/tetris11/TMPTBS.DBF'
CHARACTER SET WE8ISO8859P1
;
-- Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','ON');
-- Configure RMAN configuration record 2
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('BACKUP OPTIMIZATION','ON');
-- Configure RMAN configuration record 3
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('RETENTION POLICY','TO REDUNDANCY 2');
-- Configure RMAN configuration record 4
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1');
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u02/app/oracle/fast_recovery_area/TETRIS11/archivelog/2013_05_17/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u02/app/oracle/fast_recovery_area/TETRIS11/archivelog/2013_05_17/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u02/app/oracle/fast_recovery_area/TETRIS11/archivelog/2013_05_17/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/app/oracle/oradata/tetris11/temp01.dbf' REUSE;
-- End of tempfile additions.
--

*** 2013-05-17 14:41:21.702
Processing Oradebug command 'tracefile_name '

*** 2013-05-17 14:41:21.710
Oradebug command 'tracefile_name ' console output:
/u02/app/oracle/diag/rdbms/tetris11/tetris11/trace/tetris11_ora_1158_controlfilerecreate.trc

*** 2013-05-17 14:41:49.724
Stopping background process MMNL

*** 2013-05-17 14:41:50.724
Stopping background process MMON

*** 2013-05-17 14:41:51.746
ksukia: Starting kill, flags = 1
ksukia: killed 0 out of 0 processes.
*** 2013-05-17 14:41:51.762 4320 krsh.c
ARCH: Archival disabled due to shutdown: 1089

*** 2013-05-17 14:41:52.763
*** 2013-05-17 14:41:52.763 4320 krsh.c
ARCH: Archival disabled due to shutdown: 1089
bash-3.2$


Backup controlfiles


bash-3.2$ cd /u02/app/oracle/oradata/tetris11/
bash-3.2$ ls -l
total 50915808
-rw-r-----   1 ora11gr2 oinstall 104865792 May 17 14:02 BNA01.DBF
-rw-r-----   1 ora11gr2 oinstall 104865792 May 17 14:02 TIGOIDX_01.DBF
-rw-r-----   1 ora11gr2 oinstall 2147491840 May 17 14:02 TIGOTBS_01.DBF
-rw-r-----   1 ora11gr2 oinstall 314580992 May 17 14:02 TMPTBS.DBF
-rw-r-----   1 ora11gr2 oinstall 10764288 May 17 14:41 control01.ctl
-rw-r-----   1 ora11gr2 oinstall 555753472 May 17 14:02 idx01
-rw-r-----   1 ora11gr2 oinstall 52429312 May 17 14:02 redo01.log
-rw-r-----   1 ora11gr2 oinstall 52429312 May 17 03:32 redo02.log
-rw-r-----   1 ora11gr2 oinstall 52429312 May 17 08:57 redo03.log
-rw-r-----   1 ora11gr2 oinstall 1258299392 May 17 14:02 sysaux01.dbf
-rw-r-----   1 ora11gr2 oinstall 1384128512 May 17 14:02 system01.dbf
-rw-r-----   1 ora11gr2 oinstall 7574921216 May 17 14:02 tab01
-rw-r-----   1 ora11gr2 oinstall 406855680 May 17 11:34 temp01.dbf
-rw-r-----   1 ora11gr2 oinstall 10721697792 May 17 14:02 undotbs01.dbf
-rw-r-----   1 ora11gr2 oinstall 1315971072 May 17 14:02 users01.dbf
bash-3.2$ cp control01.ctl control01.ctl_old
bash-3.2$ ls -l
total 50936848
-rw-r-----   1 ora11gr2 oinstall 104865792 May 17 14:02 BNA01.DBF
-rw-r-----   1 ora11gr2 oinstall 104865792 May 17 14:02 TIGOIDX_01.DBF
-rw-r-----   1 ora11gr2 oinstall 2147491840 May 17 14:02 TIGOTBS_01.DBF
-rw-r-----   1 ora11gr2 oinstall 314580992 May 17 14:02 TMPTBS.DBF
-rw-r-----   1 ora11gr2 oinstall 10764288 May 17 14:41 control01.ctl
-rw-r-----   1 ora11gr2 oinstall 10764288 May 17 14:51 control01.ctl_old
-rw-r-----   1 ora11gr2 oinstall 555753472 May 17 14:02 idx01
-rw-r-----   1 ora11gr2 oinstall 52429312 May 17 14:02 redo01.log
-rw-r-----   1 ora11gr2 oinstall 52429312 May 17 03:32 redo02.log
-rw-r-----   1 ora11gr2 oinstall 52429312 May 17 08:57 redo03.log
-rw-r-----   1 ora11gr2 oinstall 1258299392 May 17 14:02 sysaux01.dbf
-rw-r-----   1 ora11gr2 oinstall 1384128512 May 17 14:02 system01.dbf
-rw-r-----   1 ora11gr2 oinstall 7574921216 May 17 14:02 tab01
-rw-r-----   1 ora11gr2 oinstall 406855680 May 17 11:34 temp01.dbf
-rw-r-----   1 ora11gr2 oinstall 10721697792 May 17 14:02 undotbs01.dbf
-rw-r-----   1 ora11gr2 oinstall 1315971072 May 17 14:02 users01.dbf
bash-3.2$ cd ../../fast_recovery_area/tetris11/
bash-3.2$ ls -l
total 21040
-rw-r-----   1 ora11gr2 oinstall 10764288 May 17 14:41 control02.ctl
bash-3.2$ cp control02.ctl control02.ctl_old
bash-3.2$ ls -l
total 42080
-rw-r-----   1 ora11gr2 oinstall 10764288 May 17 14:41 control02.ctl
-rw-r-----   1 ora11gr2 oinstall 10764288 May 17 14:51 control02.ctl_old

Recreate controlfile (NORESETLOGS)


bash-3.2$ sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Fri May 17 14:52:12 2013

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

SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2232840 bytes
Variable Size             834670072 bytes
Database Buffers          226492416 bytes
Redo Buffers                5541888 bytes
SQL>
SQL>
SQL> CREATE CONTROLFILE REUSE DATABASE "TETRIS11" NORESETLOGS  NOARCHIVELOG
  2      MAXLOGFILES 16
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 100
  5      MAXINSTANCES 8
  6      MAXLOGHISTORY 9344
  7  LOGFILE
  8    GROUP 1 (
  9      '/u02/app/oracle/oradata/tetris11/redo01.log',
 10      '/u02/app/oracle/oradata/redo/redo01_2.log'
 11    ) SIZE 50M BLOCKSIZE 512,
 12    GROUP 2 (
 13      '/u02/app/oracle/oradata/tetris11/redo02.log',
 14      '/u02/app/oracle/oradata/redo/redo02_2.log'
 15    ) SIZE 50M BLOCKSIZE 512,
 16    GROUP 3 (
 17      '/u02/app/oracle/oradata/tetris11/redo03.log',
 18      '/u02/app/oracle/oradata/redo/redo03_2.log'
 19    ) SIZE 50M BLOCKSIZE 512
 20  -- STANDBY LOGFILE
DATAFILE
 21   22    '/u02/app/oracle/oradata/tetris11/system01.dbf',
 23    '/u02/app/oracle/oradata/tetris11/sysaux01.dbf',
 24    '/u02/app/oracle/oradata/tetris11/undotbs01.dbf',
  '/u02/app/oracle/oradata/tetris11/users01.dbf',
 25   26    '/u02/app/oracle/oradata/tetris11/tab01',
 27    '/u02/app/oracle/oradata/tetris11/idx01',
 28    '/u02/app/oracle/oradata/tetris11/TIGOTBS_01.DBF',
  '/u02/app/oracle/oradata/tetris11/TIGOIDX_01.DBF',
  '/u02/app/oracle/oradata/tetris11/BNA01.DBF',
 29   30   31    '/u02/app/oracle/oradata/tetris11/TMPTBS.DBF'
 32  CHARACTER SET WE8ISO8859P1
 33  ;

Control file created.

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u02/app/oracle/oradata/tetris11/system01.dbf'


Recover database


bash-3.2$ sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Fri May 17 15:49:47 2013

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

SQL> conn / as sysdba
Connected.
SQL> select open_mode from v$database;

OPEN_MODE
--------------------
MOUNTED

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u02/app/oracle/oradata/tetris11/system01.dbf'


SQL>
SQL>
SQL>
SQL> select a.member,a.group#,b.status from v$logfile a ,v$log b where a.group#=b.group# and b.status='CURRENT';

MEMBER
--------------------------------------------------------------------------------
    GROUP# STATUS
---------- ----------------
/u02/app/oracle/oradata/redo/redo01_2.log
         1 CURRENT

/u02/app/oracle/oradata/tetris11/redo01.log
         1 CURRENT


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

Total System Global Area 1068937216 bytes
Fixed Size                  2232840 bytes
Variable Size             834670072 bytes
Database Buffers          226492416 bytes
Redo Buffers                5541888 bytes
Database mounted.
SQL> recover database using backup controlfile until cancel ;
ORA-00279: change 9173746525210 generated at 05/17/2013 08:57:14 needed for
thread 1
ORA-00289: suggestion :
/u02/app/oracle/fast_recovery_area/TETRIS11/archivelog/2013_05_17/o1_mf_1_12091_
%u_.arc
ORA-00280: change 9173746525210 for thread 1 is in sequence #12091


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u02/app/oracle/oradata/redo/redo01_2.log
Log applied.
Media recovery complete.
SQL> alter database open resetlogs;

Database altered.

Wednesday, May 15, 2013

Drop and recreate partition


Drop partition

--Drop partition P1210
ALTER TABLE acc DROP PARTITION P1210;
--Rebuild global indexes
ALTER INDEX ACC_PK REBUILD;

Recreate dropped partition by splitting upper partition 

--Split upper partition of the dropped partition (P1211) into dropped partition(P1210) and upper partition(P1211)
ALTER TABLE acc SPLIT PARTITION P1211
AT (to_date('2012-11-01','yyyy-mm-dd'))
INTO (PARTITION P1210,PARTITION P1211);
--Rebuild  global indexes
ALTER INDEX ACC_PK REBUILD;
--Gather table statistics
exec dbms_stats.gather_table_stats('<schema_name>','ACC'');