MERCADOS FINANCIEROS

viernes, 24 de abril de 2020

RESTORE VALIDATE VALIDATE DATABASE

RMAN>VALIDATE DATABASE;

RMAN>RESTORE DATABASE VALIDATE;

RMAN>VALIDATE DATAFILE 1 BLOCK 10;

RMAN>RESTORE ARCHIVELOG ALL VALIDATE;


RMAN VALIDATE DATABASE

RMAN> VALIDATE DATABASE;

Starting validate at 24-APR-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=66 device type=DISK
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00003 name=+DATA/ACME/DATAFILE/sysaux.266.1038425973
input datafile file number=00001 name=+DATA/ACME/DATAFILE/system.259.1038425973
input datafile file number=00002 name=+DATA/ACME/DATAFILE/example.257.1038425975
input datafile file number=00004 name=+DATA/ACME/DATAFILE/undotbs1.260.848598093
input datafile file number=00006 name=+DATA/ACME/DATAFILE/users.258.1038425975


RMAN>RESTORE DATABASE VALIDATE;

RMAN>RESTORE ARCHIVELOG ALL VALIDATE;

RMAN> VALIDATE TABLESPACE EXAMPLE;




miércoles, 22 de abril de 2020

adrci DIA-48494

[oracle@localhost ~]$ adrci

ADRCI: Release 12.1.0.1.0 - Production on Wed Apr 22 18:36:13 2020

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

No ADR base is set
adrci> show incident;
DIA-48494: ADR home is not set, the corresponding operation cannot be done

adrci> set base /u01/app/oracle
adrci> show incident;

ADR Home = /u01/app/oracle/diag/asm/+asm/+ASM:
*************************************************************************
0 rows fetched

ADR Home = /u01/app/oracle/diag/tnslsnr/localhost/listener:
*************************************************************************
0 rows fetched

lunes, 20 de abril de 2020

WALLET ORACLE DATABASE ./mkstore

/u01/app/oracle/product/11.2.0/db_1/bin
[oracle@localhost bin]$ ls -ltr mkstore
-rwxr-xr-x 1 oracle oinstall 2816 Mar 20  2013 mkstore


How do I create Oracle Wallet files on my database server?

From the database server: 
  1. Create a secure folder for the Oracle wallet
    mkdir -p /product/11.2.0.4/owm/wallets/ 
  2. Give permissions to the folder
    chmod -R 700 /product/11.2.0.4/owm/wallets 
  3. Create the wallet by specifying the secure folder path
    Path - /product/11.2.0.4/bin
    sudo ./mkstore -wrl /product/11.2.0.4/owm/wallets/oracle/ -create
     
  4. Configure and confirm the password
  5. Edit sqlnet.ora and add the newly created wallet location
    vi /product/11.2.0.4/network/admin/sqlnet.oraSQLNET.WALLET_OVERRIDE = TRUE
    WALLET_LOCATION=(SOURCE=(METHOD=FILE)
    (METHOD_DATA=(DIRECTORY=/product/11.2.0.4/owm/wallets/))

BACKUP MD_ BACKUP ASM DISKGROUPS

ASMCMD> md_backup /u01/backup/asm_metadata_data -G DATA
Disk group metadata to be backed up: DATA
Current alias directory path: ORCL
Current alias directory path: ORCL/ONLINELOG
Current alias directory path: COPIA/TEMPFILE
Current alias directory path: COPIA/DATAFILE
Current alias directory path: ORCL/TEMPFILE
Current alias directory path: COPIA/ONLINELOG
Current alias directory path: ORCL/PARAMETERFILE
Current alias directory path: ORCL/CONTROLFILE
Current alias directory path: COPIA
Current alias directory path: ORCL/DATAFILE
Current alias directory path: COPIA/CONTROLFILE

ASMCMD> md_backup /u01/app/oracle/backup/fra -G fra

ASMCMD> md_backup /u01/backup/fra.cop -G fra


ASMCMD> md_backup /u01/backup/asm_metadata_fra -G FRA
Disk group metadata to be backed up: FRA
Current alias directory path: ORCL/ARCHIVELOG/2019_10_11
Current alias directory path: ORCL/ARCHIVELOG/2020_04_02
Current alias directory path: ORCL
Current alias directory path: ORCL/BACKUPSET/2020_04_20
Current alias directory path: ORCL/BACKUPSET
Current alias directory path: ORCL/ARCHIVELOG
Current alias directory path: ORCL/ARCHIVELOG/2020_04_20
Current alias directory path: ORCL/CONTROLFILE
Current alias directory path: ORCL/ARCHIVELOG/2017_09_13
Current alias directory path: COPIA/CONTROLFILE
Current alias directory path: ORCL/AUTOBACKUP
Current alias directory path: ORCL/ARCHIVELOG/2017_03_06
Current alias directory path: ORCL/ARCHIVELOG/2017_12_13
Current alias directory path: COPIA/ONLINELOG
Current alias directory path: ORCL/ONLINELOG
Current alias directory path: ORCL/ARCHIVELOG/2020_03_24
Current alias directory path: ORCL/AUTOBACKUP/2020_04_20
Current alias directory path: ORCL/ARCHIVELOG/2020_03_21
Current alias directory path: COPIA
ASMCMD>

BACKUP AS BACKUPSET ALL

RMAN> backup as backupset backupset all;

Starting backup at 20-APR-20
using channel ORA_DISK_1
channel ORA_DISK_1: input backup set: count=7, stamp=937942921, piece=1
channel ORA_DISK_1: starting piece 1 at 20-APR-20
channel ORA_DISK_1: backup piece /u02/backups/rman/orcl/2017-03-06/full_ORCL_07rufns9_1_1_20170306.bak
piece handle=+FRA/orcl/backupset/2020_04_20/nnndf0_0.284.1038252993 comment=NONE
channel ORA_DISK_1: finished piece 1 at 20-APR-20
channel ORA_DISK_1: backup piece complete, elapsed time: 00:00:07
channel ORA_DISK_1: input backup set: count=9, stamp=937942969, piece=1
channel ORA_DISK_1: starting piece 1 at 20-APR-20


LO IDEAL ES HACER ESTE BACKUP SEMANAL Y MANDARLO A CINTA DE ESTA FORMA

RMAN>; BACKUP DEVICE TYPE sbt BACKUPSET ALL;

RMAN LIMITAR MAXPIECESIZE

RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE = 200M;  

new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 200 M;
new RMAN configuration parameters are successfully stored
released channel: ORA_DISK_1

RMAN> backup database plus archivelog;


Starting backup at 20-APR-20
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=33 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=6 RECID=1 STAMP=916928468
input archived log thread=1 sequence=7 RECID=2 STAMP=923564412
input archived log thread=1 sequence=8 RECID=3 STAMP=923573422
input archived log thread=1 sequence=9 RECID=4 STAMP=923672051
input archived log thread=1 sequence=10 RECID=5 STAMP=936608997
input archived log thread=1 sequence=11 RECID=6 STAMP=936609359


RMAN> BACKUP DATAFILE 1 SECTION SIZE 100M TAG 'SECTION SIZE 100M';


BACKUP AS COPY DATABASE SECTION SIZE (NO ES SOPORTADO)

RMAN> backup as copy database section size = 100M;

Starting backup at 20-APR-20
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 04/20/2020 19:19:52
RMAN-06580: the SECBYTES option cannot be used with AS COPY

RMAN>



viernes, 17 de abril de 2020

RMAN MONITOR CHANGE TRACKING

MONITOREAR ESTADO BACKUP INCREMENTALES < 20%


SELECT file#, avg(datafile_blocks), avg(blocks_read), avg(blocks_read/datafile_blocks)*100 AS PCT_READ_FOR_BACKUP, avg(blocks)
FROM V$BACKUP_DATAFILE
WHERE used_change_tracking='YES' and incremental_level>0
GROUP BY file#
/

Monitoring RMAN Job Progress

Monitoring RMAN Job Progress

SQL>select sid, serial#, sofar, totalwork, opname,
2 round(sofar/totalwork*100,2) "% Complete"
3 from v$session_longops
4 where opname LIKE 'RMAN%'
5 and opname NOT LIKE '%aggregate%'
6 and totalwork != 0
7 and sofar <> totalwork;

SID SERIAL# SOFAR TOTALWORK OPNAME % Complete
---------- ---------- ---------- ---------- ---------------------------------------------------------------- ----------
2838 43105 902382 902956 RMAN: archived log backup 99,94


column event format a40
column username format a20
set linesize 200
set pagesize 20
SELECT inst_id, SID,EVENT, WAIT_TIME, SEQ#,STATE, seconds_in_wait, username, program FROM GV$SESSION
WHERE EVENT NOT IN ('VKRM Idle','lreg timer','heartbeat redo informer','AQPC idle','EMON slave idle wait','SQL*Net message from client', 'pmon timer','rdbms ipc message','virtual circuit next request','GCR sleep','JOX Jit Process Sleep',
'smon timer','slave wait','SQL*Net message to client','pipe get','gcs remote message','ges remote message','wakeup time manager','PX Deq: reap credit','PX Deq: Execute Reply','global cache cr request','jobq slave wait','ASM background timer','DIAG idle wait','class slave wait','jobq slave wait','PX Deq: Execution Msg','fbar timer','VKTM Logical Idle Wait','Space Manager: slave idle wait','PING','wait for unread message on broadcast channel','LNS ASYNC end of log',
'watchdog main loop','pman timer','gcs yield cpu','LGWR worker group idle','LGWR worker group idle','ASM cluster membership changes','Streams AQ: qmn slave idle wait','Data Guard: Gap Manager',
'Streams AQ: qmn coordinator idle wait','REPL Capture/Apply: RAC AQ qmn coordinator','watchdog main loop','OFS idle','watchdog main loop','SCM slave idle','Data Guard: Timer','Streams AQ: waiting for time management or cleanup tasks','watchdog main loop',
'pman timer','gcs yield cpu','ASM cluster membership changes','Data Guard: Timer','watchdog main loop','OFS idle','watchdog main loop','LGWR worker group idle','LGWR worker group idle','SCM slave idle','Data Guard: Gap Manager',
'REPL Capture/Apply: RAC AQ qmn coordinator','Streams AQ: waiting for time management or cleanup tasks','Streams AQ: qmn slave idle wait','Streams AQ: qmn coordinator idle wait','Data Guard: controlfile update','LNS ASYNC dest activation','parallel recovery slave next change','SQL*Net more data from client','MRP redo arrival','parallel recovery slave next change','parallel recovery slave next change','LMS CR slave timer','ASM IO for non-blocking poll','cell ram cache population');


BACKUP AS COPY DATABASE FORMAT - BACKUP AS COPY ARCHIVELOG

RMAN>BACKUP AS COPY DATABASE FORMAT '/u01/backup/%U';

Starting backup at 14-NOV-18
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA/ACME/DATAFILE/system.258.848598015
output file name=/u01/app/oracle/backup/data_D-ACME_I-2033062067_TS-SYSTEM_FNO-1_0dti7k0u tag=TAG20181114T195302 RECID=1 STAMP=992202797
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA/ACME/DATAFILE/sysaux.257.848597951
output file name=/u01/app/oracle/backup/data_D-ACME_I-2033062067_TS-SYSAUX_FNO-3_0eti7k1e tag=TAG20181114T195302 RECID=2 STAMP=992202808
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/ACME/DATAFILE/example.266.848598231
output file name=/u01/app/oracle/backup/data_D-ACME_I-2033062067_TS-EXAMPLE_FNO-2_0fti7k1t tag=TAG20181114T195302 RECID=3 STAMP=992202818
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/ACME/DATAFILE/undotbs1.260.848598093
output file name=/u01/app/oracle/backup/data_D-ACME_I-2033062067_TS-UNDOTBS1_FNO-4_0gti7k25 tag=TAG20181114T195302 RECID=4 STAMP=992202822
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03

RMAN>BACKUP AS COPY ARCHIVELOG ALL FORMAT  '/u01/backup/%U';

BACKUP AS COPY DATAFILE +ASM

RMAN> backup as copy datafile '+DATA/ACME/DATAFILE/example.266.848598231';

Starting backup at 17-APR-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/ACME/DATAFILE/example.266.848598231
output file name=+FRA/ACME/DATAFILE/example.306.1037994741 tag=TAG20200417T195220 RECID=11 STAMP=1037994759
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
Finished backup at 17-APR-20

Starting Control File and SPFILE Autobackup at 17-APR-20
piece handle=+FRA/ACME/AUTOBACKUP/2020_04_17/s_1037994766.305.1037994767 comment=NONE
Finished Control File and SPFILE Autobackup at 17-APR-20

RMAN>

BACKUP AS BACKUPSET TABLESPACE

RMAN> backup as backupset format '/u01/backup/%U' tablespace users;

RMAN> backup as copy archivelog like '+FRA%';

Starting backup at 17-APR-20
using channel ORA_DISK_1
specification does not match any archived log in the repository
backup cancelled because there are no files to backup
Finished backup at 17-APR-20

[oracle@localhost ~]$ rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Fri Apr 17 19:56:31 2020

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

connected to target database: ORCL (DBID=1376021099)

RMAN> backup as copy archivelog like '/u01/app/oracle/fast_recovery_area%';

Starting backup at 17-APR-20
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=69 device type=DISK
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=204 RECID=172 STAMP=1037825464
output file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_04_17/o1_mf_1_204_h9nn3bf7_.arc RECID=179 STAMP=1037995035
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=205 RECID=173 STAMP=1037825755
output file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_04_17/o1_mf_1_205_h9nn3cob_.arc RECID=180 STAMP=1037995035
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=206 RECID=174 STAMP=1037833246
output file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_04_17/o1_mf_1_206_h9nn3dwj_.arc RECID=181 STAMP=1037995037
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=207 RECID=175 STAMP=1037890848
output file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/


BACKUP AS COPY


RMAN> backup as copy incremental level 0 database;

Starting backup at 17-APR-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_9qwm8fym_.dbf
output file name=/u01/app/oracle/fast_recovery_area/ORCL/datafile/o1_mf_sysaux_h9ns0c5m_.dbf tag=TAG20200417T212058 RECID=7 STAMP=1038000097
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_h8bfs33d_.dbf
output file name=/u01/app/oracle/fast_recovery_area/ORCL/datafile/o1_mf_system_h9ns1rdv_.dbf tag=TAG20200417T212058 RECID=8 STAMP=1038000118
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_9qwmmkbr_.dbf
output file name=/u01/app/oracle/fast_recovery_area/ORCL/datafile/o1_mf_example_h9ns27hv_.dbf tag=TAG20200417T212058 RECID=9 STAMP=1038000125


RMAN>BACKUP AS COPY DATABASE FORMAT '/u01/backup/%U';

Starting backup at 14-NOV-18
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA/ACME/DATAFILE/system.258.848598015
output file name=/u01/app/oracle/backup/data_D-ACME_I-2033062067_TS-SYSTEM_FNO-1_0dti7k0u tag=TAG20181114T195302 RECID=1 STAMP=992202797
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA/ACME/DATAFILE/sysaux.257.848597951
output file name=/u01/app/oracle/backup/data_D-ACME_I-2033062067_TS-SYSAUX_FNO-3_0eti7k1e tag=TAG20181114T195302 RECID=2 STAMP=992202808
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/ACME/DATAFILE/example.266.848598231
output file name=/u01/app/oracle/backup/data_D-ACME_I-2033062067_TS-EXAMPLE_FNO-2_0fti7k1t tag=TAG20181114T195302 RECID=3 STAMP=992202818
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/ACME/DATAFILE/undotbs1.260.848598093
output file name=/u01/app/oracle/backup/data_D-ACME_I-2033062067_TS-UNDOTBS1_FNO-4_0gti7k25 tag=TAG20181114T195302 RECID=4 STAMP=992202822
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=+DATA/ACME/DATAFILE/users.259.848598091
output file name=/u01/app/oracle/backup/data_D-ACME_I-2033062067_TS-USERS_FNO-6_0hti7k28 tag=TAG20181114T195302 RECID=5 STAMP=992202824
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 14-NOV-18

TABLESPACE NOLOGGING Y GUARANTEE

VALIDAR TABLESPACES


SQL> select tablespace_name,retention from dba_tablespaces;

TABLESPACE_NAME        RETENTION
------------------------------ -----------
SYSTEM        NOT APPLY
SYSAUX        NOT APPLY
UNDOTBS1        GUARANTEE
TEMP        NOT APPLY
USERS        NOT APPLY
EXAMPLE        NOT APPLY

6 rows selected.





SQL> select tablespace_name,status,logging from dba_tablespaces;

TABLESPACE_NAME        STATUS LOGGING
------------------------------ --------- ---------
SYSTEM        ONLINE LOGGING
SYSAUX        ONLINE LOGGING
UNDOTBS1        ONLINE LOGGING
TEMP        ONLINE NOLOGGING
USERS        ONLINE LOGGING
EXAMPLE        ONLINE NOLOGGING

6 rows selected.

SQL> alter tablespace example logging;

Tablespace altered.

SQL> select tablespace_name,status,logging from dba_tablespaces;

TABLESPACE_NAME        STATUS LOGGING
------------------------------ --------- ---------
SYSTEM        ONLINE LOGGING
SYSAUX        ONLINE LOGGING
UNDOTBS1        ONLINE LOGGING
TEMP        ONLINE NOLOGGING
USERS        ONLINE LOGGING
EXAMPLE        ONLINE LOGGING

6 rows selected.

SQL> alter tablespace example nologging;

Tablespace altered.

SQL> select tablespace_name,status,logging from dba_tablespaces;

TABLESPACE_NAME        STATUS LOGGING
------------------------------ --------- ---------
SYSTEM        ONLINE LOGGING
SYSAUX        ONLINE LOGGING
UNDOTBS1        ONLINE LOGGING
TEMP        ONLINE NOLOGGING
USERS        ONLINE LOGGING
EXAMPLE        ONLINE NOLOGGING

6 rows selected.

SQL> alter tablespace example logging;

Tablespace altered.

VALIDAR TABLAS LOGGING

sql> select owner,table_name,LOGGING from dba_tables where owner='HR'

COLOCAR UNA TABLE EN MODE NOLOGGING

alter table customer nologging;

ENABLE CHANGE TRACKING

Use Block Change Tracking

The acquired bank's data warehouse runs on Oracle Database 10g, which offers a few tools John can use to achieve his objectives. For the first objective, he decides to use the Block Change Tracking feature, new in this version. Block change tracking causes the changed database blocks to be flagged in a special file.

SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '/u01/backup/rman/rman.trc';


NOTA: SE ACTIVA CUANDO TENGO UNA ESTRATEGIA DE BACKUP RMAN INCREMENTAL.

SQL> alter database enable block change tracking using file '/u01/backup/rman/tracking.trc';

SQL>  alter database disable block change tracking;

MONITOREAR ESTADO BACKUP INCREMENTALES < 20%


SELECT file#, avg(datafile_blocks), avg(blocks_read), avg(blocks_read/datafile_blocks)*100 AS PCT_READ_FOR_BACKUP, avg(blocks)
FROM V$BACKUP_DATAFILE
WHERE used_change_tracking='YES' and incremental_level>0
GROUP BY file#
/

miércoles, 15 de abril de 2020

BACKUP RMAN KEEP FOREVER

ESTOS COMANDOS SOLO FUNCIONAN CUANDO SE UTILIZA UNTIL TIME


RMAN> backup database format '/u01/backup/%U' tag 'BACKUP FULL' keep until time 'sysdate + 30'
2> ;

Starting backup at 30-NOV-20
current log archived

allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=32 device type=DISK
backup will be obsolete on date 30-DEC-20
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_9qwm8fym_.dbf
input datafile file number=00001 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_9qwmbsr6_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_9qwmf6kp_.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_9qwmmkbr_.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_htct3xg4_.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_9qwmf54t_.dbf
channel ORA_DISK_1: starting piece 1 at 30-NOV-20


ESTOS COMANDOS SOLO FUNCIONAN CUANDO SE TIENE UN CATALOGO DE RMAN 

RMAN> backup datafile 1 keep forever;

Starting backup at 30-NOV-20
current log archived

using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 11/30/2020 19:03:40
RMAN-06522: KEEP FOREVER option is not supported without the recovery catalog

RMAN> 


RMAN> change backupset 77,78,79 keep until time 'sysdate + 40';

allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=74 device type=DISK
keep attributes for the backup are changed
backup will be obsolete on date 09-JAN-21
backup set key=77 RECID=77 STAMP=1057863668
keep attributes for the backup are changed
backup will be obsolete on date 09-JAN-21
backup set key=78 RECID=78 STAMP=1057863673
keep attributes for the backup are changed
backup will be obsolete on date 09-JAN-21
backup set key=79 RECID=79 STAMP=1057863674

RMAN> 

RMAN ARCHIVELOG DELETION POLICY


RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO DEVICE TYPE SBT;

RMAN>CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 2 TIMES TO DEVICE TYPE DISK;

RMAN CONFIGURE ARCHIVELOG DELETION POLICY CLEAR;

RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO none;

RMAN> configure archivelog deletion policy to backed up 1 times to device type disk;

RMAN> backup as compressed backupset archivelog all;
RMAN> backup archivelog all delete input;
RMAN> backup archivelog all;
RMAN> delete archivelog until time 'sysdate-5';
RMAN> delete noprompt archivelog until time 'sysdate-5';
RMAN> backup archivelog all not backed up;

miércoles, 8 de abril de 2020

SQL ESPACIO FLASH RECOVERY AREA

SQL> select open_mode,log_mode from v$database;

OPEN_MODE      LOG_MODE
-------------------- ------------
READ WRITE      ARCHIVELOG

SQL> 


SELECT space_used/1024/1024/1024 AS "Space Used (Gb)",   space_reclaimable/1024/1024/1024 AS "Space Reclaimable (Gb)"  FROM v$recovery_file_dest
/
set lines 150
col name format a50
select * from v$instance;
show parameter control
show parameter config
show parameter db_recovery_file
select * from v$recovery_file_dest;
select * from v$flash_recovery_area_usage;
select
  round((a.space_limit / 1024 / 1024 / 1024), 2) as flash_in_gb,
  round((a.space_used / 1024 / 1024 / 1024), 2) as flash_used_in_gb,
  round((a.space_reclaimable / 1024 / 1024 / 1024), 2) as flash_reclaimable_gb,
  sum(b.percent_space_used)  as percent_of_space_used
from
  v$recovery_file_dest a,
  v$flash_recovery_area_usage b
group by
  space_limit,
  space_used ,
  space_reclaimable ;
exit




jueves, 2 de abril de 2020

INTERVALO YEAR TO MONTH

sql> connect hr/hr;


CREATE TABLE candidates (
    first_name VARCHAR2(50) NOT NULL,
    last_name VARCHAR2(50) NOT NULL,
    job_title VARCHAR2(255) NOT NULL,
    year_of_experience INTERVAL YEAR TO MONTH
    );

INSERT INTO candidates (
    first_name,
    last_name,
    job_title,
    year_of_experience
    )
VALUES (
    'Camila',
    'Kramer',
    'SCM Manager',
    INTERVAL '10-2' YEAR TO MONTH
    );
 
COMMIT;

SELECT * FROM CANDIDATES