MERCADOS FINANCIEROS

sábado, 25 de julio de 2020

PARAMETROS FLASHBACK DATABASE

SQL> select open_mode,log_mode,flashback_on from v$database;

OPEN_MODE      LOG_MODE   FLASHBACK_ON
-------------------- ------------ ------------------
READ WRITE      ARCHIVELOG   NO

SQL> 


SQL> show parameter db_flashback;

NAME      TYPE VALUE
------------------------------------ ----------- ------------------------------
db_flashback_retention_target      integer 1440
SQL> 

sábado, 18 de julio de 2020

Backup and Restore of ASM Metadata in Oracle 11gR2 (md_backup and md_restore)


Backup and Restore of ASM Metadata in Oracle 11gR2 (md_backup and md_restore)
ASMCMD utility was introduced in Oracle 10g and offered some basic features for navigation, search, monitoring and management, for full description see the docs here. In Oracle 11gR1 the asmcmd functionality was extended to include ability to backup existing disk groups metadata among other new 11g features, for full information refer to the docs here. In Oracle 11gR2 with the introduction of the ACFS the ASMCMD functionality was further extended see here. In Oracle 11gR2 ASMCMD can be used to perform almost all of the activities that used to be performed from sqlplus prompt previously and both sqlplus and asmcmd can be used interchangeably. In this article I will demo how to backup a disk group using md_backup command and use md_restore to obtain the SQL statements to recreate the disk groups and all the dependencies such as templates, aliases, directories and disk group attributes.
The syntax of md_backup in Oracle 11gR2 is as follow.
ASMCMD> md_backup
usage: md_backup backup_file [-G diskgroup [,diskgroup,…]]
help: help md_backup
ASMCMD>
The syntax of md_restore is as follow.
ASMCMD> md_restore
usage: md_restore backup_file [–silent][–full|–nodg|–newdg -o ‘old_diskgroup:new_diskgroup [,…]’][-S sql_script_file] [-G ‘diskgroup [,diskgroup…]’]

md_backup /tmp/backup_ASM.bcp -G data,dgdup,dgdup1,dgdup2,prim,sec

The backed diskgroup metadata can be directly restored upon failure of the disk or we can have asmcmd generate a script and later use the script to generate the disk groups and all of the dependencies from sqlplus.

md_restore /tmp/backup_ASM.bcp –full -S /tmp/ASM_diskgroup.sql


ASMCMD>  md_backup backup.bck -G data,fra


jueves, 16 de julio de 2020

RMAN BACKUP ARCHIVELOG DELETE INPUT - BACKUP ARCHIVELOG ALL NOT BACKED UP

[oracle@localhost ~]$ rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Jul 16 20:58:48 2020

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

connected to target database: ACME (DBID=2033062067)

RMAN> backup archivelog all delete input;

Starting backup at 16-JUL-20
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=26 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=96 RECID=92 STAMP=1045765588
input archived log thread=1 sequence=97 RECID=93 STAMP=1045765746
input archived log thread=1 sequence=98 RECID=94 STAMP=1045775298
input archived log thread=1 sequence=99 RECID=95 STAMP=1045778863
input archived log thread=1 sequence=100 RECID=96 STAMP=1045796445
input archived log thread=1 sequence=101 RECID=97 STAMP=1045832437
input archived log thread=1 sequence=102 RECID=98 STAMP=1045855635
input archived log thread=1 sequence=103 RECID=99 STAMP=1045862756
input archived log thread=1 sequence=104 RECID=100 STAMP=1045865866
input archived log thread=1 sequence=105 RECID=101 STAMP=1045915239
input archived log thread=1 sequence=106 RECID=102 STAMP=1045937427
input archived log thread=1 sequence=107 RECID=103 STAMP=1045937613
input archived log thread=1 sequence=108 RECID=104 STAMP=1045947407
input archived log thread=1 sequence=109 RECID=105 STAMP=1045947539
channel ORA_DISK_1: starting piece 1 at 16-JUL-20
channel ORA_DISK_1: finished piece 1 at 16-JUL-20
piece handle=+FRA/ACME/BACKUPSET/2020_07_16/annnf0_tag20200716t205900_0.267.1045947543 tag=TAG20200716T205900 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: deleting archived log(s)
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_14/thread_1_seq_96.264.1045765587 RECID=92 STAMP=1045765588
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_14/thread_1_seq_97.279.1045765745 RECID=93 STAMP=1045765746
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_14/thread_1_seq_98.289.1045775295 RECID=94 STAMP=1045775298
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_14/thread_1_seq_99.265.1045778813 RECID=95 STAMP=1045778863
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_15/thread_1_seq_100.263.1045796439 RECID=96 STAMP=1045796445
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_15/thread_1_seq_101.260.1045832433 RECID=97 STAMP=1045832437
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_15/thread_1_seq_102.272.1045855633 RECID=98 STAMP=1045855635
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_15/thread_1_seq_103.300.1045862755 RECID=99 STAMP=1045862756
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_15/thread_1_seq_104.301.1045865821 RECID=100 STAMP=1045865866
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_16/thread_1_seq_105.302.1045915235 RECID=101 STAMP=1045915239
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_16/thread_1_seq_106.303.1045937425 RECID=102 STAMP=1045937427
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_16/thread_1_seq_107.294.1045937613 RECID=103 STAMP=1045937613
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_16/thread_1_seq_108.266.1045947405 RECID=104 STAMP=1045947407
archived log file name=+FRA/ACME/ARCHIVELOG/2020_07_16/thread_1_seq_109.273.1045947539 RECID=105 STAMP=1045947539
Finished backup at 16-JUL-20

Starting Control File and SPFILE Autobackup at 16-JUL-20
piece handle=+FRA/ACME/AUTOBACKUP/2020_07_16/s_1045947576.273.1045947577 comment=NONE
Finished Control File and SPFILE Autobackup at 16-JUL-20

RMAN> 


RMAN> BACKUP ARCHIVELOG ALL NOT BACKED UP;

Starting backup at 21-JUL-20
current log archived
using channel ORA_DISK_1
skipping archived logs of thread 1 from sequence 73 to 93; already backed up
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=94 RECID=90 STAMP=1046378942
channel ORA_DISK_1: starting piece 1 at 21-JUL-20
channel ORA_DISK_1: finished piece 1 at 21-JUL-20
piece handle=+FRA/ACME/BACKUPSET/2020_07_21/annnf0_tag20200721t204902_0.300.1046378943 tag=TAG20200721T204902 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 21-JUL-20

Starting Control File and SPFILE Autobackup at 21-JUL-20
piece handle=+FRA/ACME/AUTOBACKUP/2020_07_21/s_1046378943.301.1046378945 comment=NONE
Finished Control File and SPFILE Autobackup at 21-JUL-20

RMAN> 




ALTER INDEX REBUILD

SQL>analyze table hr.prueba validate structure;

EJECUTAR EL SCRIPT

SQL>analyze index hr.EMP_EMAIL_UK VALIDATE STRUCTURE;

NOTA: VALIDAR SI EL PORCENTAJE ES MAYOR AL 20%

SQL>select name, del_lf_rows/lf_rows*100 reclaimable_space_pct from index_stats where name='EMP_EMAIL_UK';

SQL>alter index hr.EMP_EMAIL_UK rebuild;

SQL>alter index hr.EMP_EMAIL_UK monitoring usage;

SQL>  alter index hr.EMP_EMAIL_UK invisible;

Index altered.

SQL>  alter index hr.EMP_EMAIL_UK visible;

Index altered.

SQL> SELECT index_name, used, monitoring from v$object_usage where index_name = 'EMP_EMAIL_UK';

no rows selected


SQL> alter index hr.EMP_EMAIL_UK invisible;

Index altered.

SQL> alter index hr.EMP_EMAIL_UK visible;

Index altered.

SQL> 


RMAN TRACE - DEBUG

EJEMPLO 1

[oracle@localhost backup]$ rman target / trace trace.log

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Jul 16 18:24:42 2020

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

connected to target database: ORCL (DBID=1376021099)

RMAN> host;

[oracle@localhost backup]$ ls
ACME  asm_metadata_data  asm_metadata_fra  control.trc  trace.log
[oracle@localhost backup]$ exit
exit
host command complete

RMAN> backup datafile 1;

Starting backup at 16-JUL-20
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=60 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_hhqvrdhj_.dbf
channel ORA_DISK_1: starting piece 1 at 16-JUL-20
channel ORA_DISK_1: finished piece 1 at 16-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2020_07_16/o1_mf_nnndf_TAG20200716T182516_hk1rgwjx_.bkp tag=TAG20200716T182516 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
Finished backup at 16-JUL-20

Starting Control File and SPFILE Autobackup at 16-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2020_07_16/o1_mf_s_1045938351_hk1rj01v_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 16-JUL-20

RMAN> 

EJEMPLO 2


[oracle@localhost backup]$ rman target / trace trace.log

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Jul 16 18:29:07 2020

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

connected to target database: ORCL (DBID=1376021099)

RMAN> run 
2> {
3> debug on;
4> backup datafile 2;
5> debug off;
6> }

RMAN-03036: Debugging set to level=9, types=ALL

RMAN-03090: Starting backup at 16-JUL-20
RMAN-06009: using target database control file instead of recovery catalog
RMAN-08030: allocated channel: ORA_DISK_1
RMAN-08500: channel ORA_DISK_1: SID=62 device type=DISK
RMAN-08008: channel ORA_DISK_1: starting full datafile backup set
RMAN-08010: channel ORA_DISK_1: specifying datafile(s) in backup set
RMAN-08522: input datafile file number=00002 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_hjwsv73p_.dbf
RMAN-08038: channel ORA_DISK_1: starting piece 1 at 16-JUL-20
RMAN-08044: channel ORA_DISK_1: finished piece 1 at 16-JUL-20
RMAN-08530: piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2020_07_16/o1_mf_nnndf_TAG20200716T182948_hk1rqd92_.bkp tag=TAG20200716T182948 comment=NONE
RMAN-08540: channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
RMAN-03091: Finished backup at 16-JUL-20

RMAN-03090: Starting Control File and SPFILE Autobackup at 16-JUL-20
RMAN-08503: piece handle=/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2020_07_16/o1_mf_s_1045938595_hk1rqmkk_.bkp comment=NONE
RMAN-03091: Finished Control File and SPFILE Autobackup at 16-JUL-20

Debugging turned off

RMAN> 


EJEMPLO 3

[oracle@localhost ~]$ rman target / debug trace trace.log

Recovery Manager: Release 12.1.0.1.0 - Production on Mon May 24 19:43:56 2021

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

RMAN-06005: connected to target database: ORCL (DBID=1376021099)

RMAN> backup database;   

RMAN-03090: Starting backup at 24-MAY-21
RMAN-06009: using target database control file instead of recovery catalog
RMAN-08030: allocated channel: ORA_DISK_1
RMAN-08500: channel ORA_DISK_1: SID=37 device type=DISK
RMAN-08008: channel ORA_DISK_1: starting full datafile backup set
RMAN-08010: channel ORA_DISK_1: specifying datafile(s) in backup set
RMAN-08522: input datafile file number=00003 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_9qwm8fym_.dbf
RMAN-08522: input datafile file number=00001 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_j9cy9cfn_.dbf
RMAN-08522: input datafile file number=00004 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_9qwmf6kp_.dbf
RMAN-08522: input datafile file number=00007 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_j86zjfnv_.dbf



MONITOREAR TEMPERATURA

https://www.alcpu.com/CoreTemp/