Wednesday, 12 September 2018

RMAN point in time restore challenge 12c

RMAN point in time pdb restore (using duplicate), gives error due issue with different pdb. Using Oracle 12.1.0.2.0 This is the restore command, I was using: rman auxiliary / catalog rmanuser/password1@CATDB run{ set UNTIL TIME "to_date('2018-07-15 00:00:01','YYYY-MM-DD HH24:MI:SS')" ; DUPLICATE DATABASE 'proddb2' TO 'NI_REST' PLUGGABLE DATABASE CUSTX_PDB; }

Error [1] faced, due to another pdb issue Skipping pluggable database CUST_PDB5 Skipping pluggable database CUST_PDB6 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of Duplicate Db command at 09/06/2018 16:44:40 RMAN-05501: aborting duplication of target database RMAN-06813: could not translate pluggable database STG_CUSTYPDB

Workaround, not using catalog rman auxiliary / target sys/password2@proddb2 run{ set UNTIL TIME "to_date('2018-07-15 00:00:01','YYYY-MM-DD HH24:MI:SS')" ; DUPLICATE DATABASE TO 'NI_REST' PLUGGABLE DATABASE CUSTX_PDB; }

Error [2] now faced, due to missing arc Executing: alter database datafile 832 offline drop Executing: alter database datafile 833 offline drop Executing: alter database datafile 834 offline drop starting media recovery unable to find archived log archived log thread=1 sequence=13054 Oracle Error: ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below ORA-01194: file 3 needs more recovery to be consistent ORA-01110: data file 3: '+DATA/NI_REST/DATAFILE/sysaux.675.986210261' RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of Duplicate Db command at 09/07/2018 13:24:29 RMAN-05501: aborting duplication of target database RMAN-03015: error occurred in stored script Memory Script RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 13054 and starting SCN of 7885151161 RMAN>

Workaround
  1. Restored around 15 archive log, starting from above sequence (13054, also for thread 2)
  2. Redone the RMAN clone command
  3. Opening db gave error with control file
  4. Create backup control file, used RESETLOGS block
    1. Removed all non NI_REST datafiles
    2. Kept only 3 LOGFILE, they do not exits on filesystem
  5. Run the backup control (notice has parent db name (PRODDB2) and resetlogs)
  6. Start db with open resetlog
  7. Opened the pdb successfully
  8. Recreated the temp file
With the above, restore was successful. exported the schema from pdb and aux db dropped.


Appendix: catalog start with /u01/oracle/product/12102_01/dbs/' noprompt; alter database backup controlfile to trace as '/home/oracle/mydb_new.ctl.txt'; STARTUP NOMOUNT CREATE CONTROLFILE REUSE DATABASE "PRODDB2" RESETLOGS ARCHIVELOG MAXLOGFILES 192 MAXLOGMEMBERS 3 MAXDATAFILES 1024 MAXINSTANCES 32 MAXLOGHISTORY 584 LOGFILE GROUP 1 '+DATA/NI_REST/ONLINELOG/group_1.262.903320613' SIZE 1024M BLOCKSIZE 512, GROUP 2 '+DATA/NI_REST/ONLINELOG/group_2.263.903320623' SIZE 1024M BLOCKSIZE 512, GROUP 3 '+DATA/NI_REST/ONLINELOG/group_3.269.903321099' SIZE 1024M BLOCKSIZE 512 -- STANDBY LOGFILE DATAFILE '+DATA/NI_REST/DATAFILE/system.693.986210261', '+DATA/NI_REST/DATAFILE/sysaux.675.986210261', '+DATA/NI_REST/DATAFILE/undotbs1.683.986210259', '+DATA/NI_REST/2B4E02B966694E2CE0533F1C6F0A31F5/DATAFILE/system.461.986212971', '+DATA/NI_REST/2B4E02B966694E2CE0533F1C6F0A31F5/DATAFILE/sysaux.467.986212969', '+DATA/NI_REST/DATAFILE/undotbs2.474.986213075', '+DATA/NI_REST/2DB32189A8D41995E0533F1C6F0A911E/DATAFILE/system.459.986212545', '+DATA/NI_REST/2DB32189A8D41995E0533F1C6F0A911E/DATAFILE/sysaux.460.986212545', '+DATA/NI_REST/2DB32189A8D41995E0533F1C6F0A911E/DATAFILE/default_pdb_ts.611.986212545', '+DATA/NI_REST/2DB32189A8D41995E0533F1C6F0A911E/DATAFILE/users.561.986213451' CHARACTER SET AL32UTF8 ; alter database OPEN RESETLOGS; alter tablespace TEMP add tempfie '+DATA' size 150m;

Appendix: error SQL> alter database open resetlogs; alter database open resetlogs * ERROR at line 1: ORA-19838: Cannot use this control file to open database

Thursday, 21 June 2018

PDB Tips

List pdbs show pdbs select * from v$pdbs; # All PDB (inc. size) col name for a30 select name, open_mode, total_size/1024/1024 as size_mb from v$pdbs where name like '%'; PDB sessions, pdb connections, pdb sess col name for a20 col username for a32 col machine for a20 select s.inst_id, p.name, s.username, s.machine, count(*) as "SESSION COUNT" from gv$session s, gv$pdbs p where p.con_id = s.con_id and s.inst_id = p.inst_id group by s.inst_id, p.name, s.username, s.machine order by p.name, s.machine; -- List only STG_BIZ_X select s.inst_id, p.name, s.username, s.machine, s.sid, s.serial#, s.status from gv$session s, gv$pdbs p where p.con_id = s.con_id and s.inst_id = p.inst_id and p.name = 'STG_BIZ_X'; INST_ID NAME USERNAME MACHINE SID SERIAL# STATUS ------- ------------- ------------- ------------ --------- ------- -------- 1 STG_BIZ_X SYS ukdevdb017 442 28213 ACTIVE 1 STG_BIZ_X C##JPTADMIN ukdevdb602 777 56244 KILLED 2 STG_BIZ_X C##JPTADMIN ukdevdb601 66 64486 KILLED 2 STG_BIZ_X SYS ukdevdb017 1959 13580 ACTIVE 2 STG_BIZ_X C##JPTADMIN ukdevdb602 1961 46827 KILLED

Grid installation prerequisites

Getting error

[grid@proddev1 ~]$ cd /u01/app/grid/12201 [grid@proddev1 12201]$ ./runcluvfy.sh stage -pre crsinst -n proddev1,proddev2 -fixup -verbose ERROR: PRVG-10467 : The default Oracle Inventory group could not be determined. Verifying '/tmp/' ...FAILED (PRVG-1901) Pre-check for cluster services setup was unsuccessful on all the nodes. Failures were encountered during execution of CVU verification request "stage -pre crsinst". Verifying '/tmp/' ...FAILED PRVG-1901 : failed to setup CVU remote execution framework directory "/tmp/CVU_12.2.0.1.0_grid/" on nodes "proddev1" trprdbr04017: Version of exectask could not be retrieved from node "trprdbr04017" trprdbr04017: Version of exectask could not be retrieved from node "trprdbr04017" CVU operation performed: stage -pre crsinst Date: Jun 21, 2018 9:37:11 AM CVU home: /u01/app/grid/12201/ User: grid


FIX: Correct the fstab, to make sure, its like below exactly

[root@proddev1 ~]# more /etc/fstab |grep -E "/tmp | /opt" /dev/mapper/vg_apol-lv_tmp /tmp ext3 defaults,nodiratime,nodev,nosuid 1 2 /dev/mapper/vg_otc0-lv_opt /opt ext3 defaults,nodiratime,nodev 1 2

Wednesday, 10 August 2016

154.41 MB of Audit Trail files collected (.aud: 154.41, .xml: 0, .bin: 0)


Enterprise Manager giving error 'Audit Trail files collected' after EM upgrade to 12.1.0.5.0

Current 'Database Instance' template was showing:

> Operating System Audit Records

> > File Count [>=, 10, 20]

After hours of investigating found my ideal fix for our environment.


Fix: Created a new 'Database Instance' and applied to database.

Now we got the desired option

> Operating System Audit Records

> > Size of Audit Files [>=, 10, 20]

After updating above numbers to 1024, 1280 and applying the template to database, above alert has gone. Selected 1GB and 1.2GB, since we the space and for all 40+ rac's size of current audit folders were 100 - 800 MB.

Monday, 2 February 2015

Basic RMAN backup / Basic Archive backup

- Simple RMAN backup / RMAN Basic backup - Simple Archive backup / Simple Archivelog backup 1. For first time RMAN backup, do some basic checks / config changes CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET; CONFIGURE CHANNEL 1 DEVICE TYPE DISK MAXOPENFILES 4 MAXPIECESIZE 5G FORMAT '/mnt/backup01/oracle/backup_rman/rmanNIDEV/nidev_b_%T_%u_%s_%p' RATE 15 M; CONFIGURE CHANNEL 2 DEVICE TYPE DISK MAXOPENFILES 4 MAXPIECESIZE 5G FORMAT '/mnt/backup01/oracle/backup_rman/rmanNIDEV/nidev_b_%T_%u_%s_%p' RATE 15 M; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/mnt/backup01/oracle/backup_rman/rmanNIDEV/nidev_cf_%F'; CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/mnt/backup01/oracle/backup_rman/rmanNIDEV/nidev_snapcf.f'; show all; 2. Here is a backup script DATELOG_ID=`date '+%Y%m%d%H%M'` rman target / <>log_rman_${DATELOG_ID}.txt show all; crosscheck archivelog all; backup incremental level=0 database plus archivelog delete input; EOF 3. Here is a basic ARCHIVE backup script DATELOG_ID=`date '+%Y%m%d%H%M'` rman target / <>log_rman_${DATELOG_ID}.txt show all; crosscheck archivelog all; backup archivelog all delete input; EOF

Sunday, 18 January 2015

How to start Apache and MySQL Automatically when Windows 7

How to start Apache and MySQL Automatically when Windows 7
How to start XAMPP Automatically when Windows 7
Xampp 3.2 autostart as service

  1. Go to XAMPP folder
  2. Find 'xanoo-control.exe'
  3. Right Click on above and run using "Run as administrator"
  4. Then you can click Servuce checkbox to install apache, Mysql as a service.

Sunday, 9 February 2014

OEM 12c How to Drop Cluster Database Target

OEM 12c How to Drop Cluster Database Target and how to drop the Cluster.

Below steps can be used to do many other similar tasks, relate to oem Agents.

  1. Click Setup > Manage Cloud Control > Agents
  2. Select the number in column "Monitored Targets" for the 1st node
  3. There you can select the Cluster and Cluster Database
  4. Once selected, click Cluster (on top left)
  5. Click Target Setup > Remove Target
  6. Click Yes to confirm
  7. (Do similar with other nodes)