Tuesday, April 21, 2015

ORA-39166: Object was not found.

oracle@hostname:$ impdp schemaname/rep123 tables=XXXX_USER directory=DATA_PUMP_DIR dumpfile=XXXX_USER.dmp logfile=impdpXXXX_USER.log TABLE_EXISTS_ACTION=APPEND;

Import: Release 11.2.0.4.0 - Production on Tue Apr 21 15:35:13 2015

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-39002: invalid operation
ORA-39166: Object XXXX_REPORTING.XXXX_USER was not found.


Since the export schema is different from the import schema we need to include remap_schema parameter in impdp utility as below.

obioracle@hostname:$ impdp schema/schemapasswrd tables=export_schema.XXX_USER directory=DATA_PUMP_DIR dumpfile=XXXX_USER.dmp logfile=impdpXXXX_USER.log remap_schema=EXPORT_SCHEMA:IMPORT_SCHEMA;

Import: Release 11.2.0.4.0 - Production on/ Tue Apr 21 15:38:07 2015

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "XXXX_REPORTING"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "XXXX_REPORTING"."SYS_IMPORT_TABLE_01":  XXXX_reporting/******** tables=EXPORT_SCHEMA.XXXX_USER directory=DATA_PUMP_DIR dumpfile=XXXX_USER.dmp logfile=impdpXXXX_USER.log remap_schema=EXPORT_SCHEMA:IMPORT_SCHEMA
Processing object type TABLE_EXPORT/TABLE/TABLE
ORA-39151: Table "XXXX_REPORTING"."XXXX_USER" exists. All dependent metadata and data will be skipped due to table_exists_action of skip
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/TRIGGER
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "XXXX_REPORTING"."SYS_IMPORT_TABLE_01" completed with 1 error(s) at Tue Apr 21 15:38:09 2015 elapsed 0 00:00:02



Thursday, April 16, 2015

How to change the default location for archivelog backup copies in RMAN

The default location for archivelog backups is the FRA (if defined) or $OH/dbs.
However once you use 'format' you are overriding the default - so the only way you can do this is to first do the backup to the usual location using a specific tag eg 'ARCH' to idenity the archuivelog backups.
Then you can backup the backupsets with that tag eg

RMAN> backup copies 2 backupset from tag 'ARCH' format 'd:\temp\%U', 'd:\keep\%U' not backed up 2 times;

so you would use a shell script to generate a tag with a specific date - to ensure you are only backing up new archivelog backupsets - the 'not backed up 2 times' doubly ensures that a backupset is only backed up once :

RMAN> backup archivelog sequence 52 tag 'ARCH';

Starting backup at 15-apr-15 08:57:28
using channel ORA_DISK_1
...
piece handle=C:\APP\11G\FAST_RECOVERY_AREA\T11204\BACKUPSET\2015_04_15\O1_MF_ANNNN_ARCH_BLW6H8GH_.BKP tag=ARCH comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 15-apr-15 08:57:29

BS Key Size
------- ----------
182 5.81M <=== bskey 52

List of Archived Logs in backup set 182
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------ ---------- ---------
1 52 9213444 13-apr-15 16:09:34 9240678 14-apr-15 07:35:00

RMAN> backup copies 2 backupset from tag 'ARCH' format 'd:\temp\%U', 'd:\keep\%U' not backed up 1 times;

Starting backup at 15-apr-15 08:57:38
using channel ORA_DISK_1
skipping backup set key 179; already backed up 2 time(s)
skipping backup set key 181; already backed up 2 time(s)
skipping backup set key 182; already backed up 1 time(s) <========== original backup , so you need 'not backed up 2 times for this to work
Finished backup at 15-apr-15 08:57:39

RMAN> backup copies 2 backupset from tag 'ARCH' format 'd:\temp\%U', 'd:\keep\%U
' not backed up 2 times;

Starting backup at 15-apr-15 08:57:57
using channel ORA_DISK_1
skipping backup set key 179; already backed up 2 time(s)
skipping backup set key 181; already backed up 2 time(s)
channel ORA_DISK_1: input backup set: count=219, stamp=877078648, piece=1
channel ORA_DISK_1: starting piece 1 at 15-apr-15 08:57:57
channel ORA_DISK_1: backup piece C:\APP\11G\FAST_RECOVERY_AREA\T11204\BACKUPSET\2015_04_15\O1_MF_ANNNN_ARCH_BLW6H8GH_.BKP
piece handle=D:\TEMP\6RQ4EA3O_1_2 comment=NONE
piece handle=D:\KEEP\6RQ4EA3O_1_3 comment=NONE
channel ORA_DISK_1: finished piece 1 at 15-apr-15 08:57:58 with 2 copies
channel ORA_DISK_1: backup piece complete, elapsed time: 00:00:01
Finished backup at 15-apr-15 08:57:58

if you are creating multiple copies eg TWO copies, then each backup has 3 copies in total so you would need to us 'not backed up 3 times' 

Wednesday, April 15, 2015

ORA-09925: Unable to create audit trail file

Issue.

-bash-4.1$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 16 09:45:39 2015

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

ERROR:
ORA-09925: Unable to create audit trail file
SVR4 Error: 2: No such file or directory
Additional information: 9925
ORA-01075: you are currently logged on

-bash-4.1$ ps -ef |grep pmon
oracle 12446     1   0 09:43:30 ?           0:00 ora_pmon_OBITEST
oracle 12481 12367   0 09:50:01 pts/1       0:00 grep pmon

-bash-4.1$ kill -9 12446

-bash-4.1$ mkdir -p /data01/TEST/admin/TEST/adump
-bash-4.1$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 16 09:53:13 2015

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

Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 5463277568 bytes
Fixed Size                  2191256 bytes
Variable Size            1342181480 bytes
Database Buffers         4110417920 bytes
Redo Buffers                8486912 bytes
Database mounted.
Database opened.
SQL>
SQL>

Script to get the user login details in Siebel


Script to fetch the User login details.

SELECT C.FST_NAME,C.MID_NAME,C.LAST_NAME,U.LAST_LOGIN_TS
FROM SIEBEL.S_USER U INNER JOIN SIEBEL.S_CONTACT C
ON U.ROW_ID=C.ROW_ID
ORDER BY U.LAST_LOGIN_TS DESC ;