Saturday, 15 September 2018

ORA-16139: media recovery required SWITCHOVER_STATUS SWITCHOVER LATENT

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
SWITCHOVER LATENT

SQL> alter database commit to switchover to primary with session shutdown;
alter database commit to switchover to primary with session shutdown
*
ERROR at line 1:
ORA-16139: media recovery required


SQL> RECOVER MANAGED STANDBY DATABASE FINISH;
Media recovery complete.
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

Database altered.

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
NOT ALLOWED

SQL> select db_unique_name,database_role,switchover_status from v$database;

DB_UNIQUE_NAME                 DATABASE_ROLE    SWITCHOVER_STATUS
------------------------------ ---------------- --------------------
MEDDB                          PRIMARY          NOT ALLOWED


SQL> alter database open;

Wednesday, 15 August 2018

NoClassDefFoundError – com/jacob/com/ComFailException

NoClassDefFoundError – com/jacob/com/ComFailException
No Jacob
The reason for this error is because the Java cache may be interfering with properly finding the Java classes associated with jacob.jar. Clearing the Java cache should fix the problem:
  1. Open up the Control Panel on the end user’s PC
  2. Go to All Control Panel Items and click “Java”
  3. With the General tab highlighted in the Java Control Panel, click “Settings…”Java Control Panel
  4. Click “Delete Files…” to prepare to delete all objects in the Java cache. Delete Temporary Java Files
  5. In the new pop-up window, have only the following selected and click “OK”:
    • Trace and Log Files
    • Cached Applications and Applets
    • Clearing Java cache
  6. After the window closes, click “OK” twice to close all windows in the Java Control Panel.

Friday, 10 August 2018

Install and configure SFTP/FTP server in Oracle Linux

Step 1: We will use localhost for our machine to setup ftp server.

Step 2: Install vsftpd (very secure FTP daemon) package.
yum install -y vsftpd
Step 3: Start FTP Server when system on.
systemctl enable vsftpd.service
Step 4: Checking the status of ftp server
systemctl status vsftpd.service
Step 5: Configure vsftpd package. We will edit
/etc/vsftpd/vsftpd.conf
Change the line which contain anonymous_enable=NO to anonymous_enable=YES
This will give permit any one to access FTP server with authentication.
Change the following to YES
local_enable=YES
write_enable=YES
Step 6: Start FTP Server
systemctl start vsftpd.service
Step 7: Install FTP Client
yum install -y lftpd
Step 8: Connect ftp to localhost
lftp localhost

Monday, 6 August 2018

Signing JAR Files

$ORACLE_HOME/jdk/bin/jarsigner -keystore .keystore_myapp -storepass abcd1234 $ORACLE_HOME/forms/java/jacob.jar myapp

Enter keystore password:  mypassword
What is your first and last name?
  [Unknown]:  Concept
What is the name of your organizational unit?
  [Unknown]:  My Concept Department
What is the name of your organization?
  [Unknown]:  My Concept Company
What is the name of your City or Locality?
  [Unknown]:  My Concept City
What is the name of your State or Province?
  [Unknown]:  My Concept State
What is the two-letter country code for this unit?
  [Unknown]:  AE
Is CN=Concept, OU=My Concept Department, O=My Concept Company, L=My Concept City, ST=My Concept State, C=AE correct?
  [no]:  yes

Enter key password for
        (RETURN if same as keystore password):


/u01/app/oracle/product/12.2.1.3/oracle_common/jdk/bin/jarsigner -keystore .keystore_myapp -storepass abcd1234 $ORACLE_HOME/forms/java/jacob.jar myapp

VirtualBox Host-Only Static IP


To create a host-only connection in VirtualBox, start by opening the preferences in VirtualBox. Go to the "Network" tab, and addd a Host-only Network. 


To get the static IP address working temporarily, access the termainal on the client, and enter the following to assign a static IP to eth1. (I'm assuming 192.168.56.101 because that's VirtualBox's default. Make sure it matches the IP for your host-only adapter.)
ifconfig eth1 192.168.56.101 netmask 255.255.255.0 up

Thursday, 12 July 2018

export multiple tables from multiple schemas expdp



create directory dumps as '/u01/dumps';


CREATE TABLE XXCRC_TLIST(  T );



 expdp \'/ as sysdba\' DUMPFILE=AhmedTables.dmp  LOGFILE=AhmedTables.log DIRECTORY=DUMPS INCLUDE=TABLE:\"in\(SELECT t FROM  apps.xxcrc_tlist\)\"  schemas=XXCRC,APPS,SYS

 impdp \'/ as sysdba\' DUMPFILE=AhmedTables.dmp  LOGFILE=AhmedTables.log DIRECTORY=DUMPS remap_schema=APPS:XXCRC table_exists_action=replace


Tuesday, 10 July 2018

Oracle Cloud backup DBCS/DBaaS



Backup Log Files:
/var/opt/oracle/bkup_api/log/bkup_api.log

OBKUP:: Uploading config files to cloud storage
Starting OSS
Logfile is /var/opt/oracle/log/oss/oss_2018-07-10_10:28:29.log
Config file is /var/opt/oracle/oss/oss.cfg


Path: /var/opt/oracle/log/ORCL/obkup
cat /var/opt/oracle/log/ORCL/obkup/obkup2018-07-09_10:12:20.log
OBKUP:: Oracle database state is up and running
catalog mode  no
################################ PERIODICAL BACKUP STARTING ################################
logfile: /var/opt/oracle/log/ORCL/obkup/obkup_2018-07-10_10:23:07.log
OBKUP:: DB instance: ORCL
OBKUP:: Determining if the filesystem is not full
Case OK : Your partition /u03 has 11% used space
Case OK : Your partition /u01 has 24% used space
Case OK : Your partition /u02 has 45% used space
OBKUP:: ...... OK
OBKUP:: Validating the backup repository ......
OBKUP::      All backup pieces are ok
OBKUP:: Performing Incremental Backup to Cloud Storage
OBKUP:: Executing rman instructions
Connection string: /u01/app/oracle/product/12.1.0/dbhome_1/bin/rman msgno target /
 -> SET ENCRYPTION ON;
 -> BACKUP DEVICE TYPE SBT AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 1 DATABASE TAG 'dbaas_incr_backup';
 -> DELETE NOPROMPT OBSOLETE;
 -> BACKUP DEVICE TYPE SBT AS COMPRESSED BACKUPSET ARCHIVELOG ALL;
 ->  RMAN OUTPUT:

      Recovery Manager: Release 12.1.0.2.0 - Production on Tue Jul 10 10:25:24 2018

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

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

      RMAN>
      RMAN-03029: echo set on


      RMAN> SET ENCRYPTION ON;
      RMAN-03023: executing command: SET encryption
      RMAN-06009: using target database control file instead of recovery catalog


      RMAN> BACKUP DEVICE TYPE SBT AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 1 DATABASE TAG 'dbaas_incr_backup';
      RMAN-03090: Starting backup at 10-JUL-2018 10:25:27
      RMAN-08030: allocated channel: ORA_SBT_TAPE_1
      RMAN-08500: channel ORA_SBT_TAPE_1: SID=308 device type=SBT_TAPE
      RMAN-08526: channel ORA_SBT_TAPE_1: Oracle Database Backup Service Library VER=12.2.0.2
      RMAN-08047: channel ORA_SBT_TAPE_1: starting compressed incremental level 1 datafile backup set
      RMAN-08010: channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
      RMAN-08522: input datafile file number=00009 name=/u02/app/oracle/oradata/ORCL/pdb1/sysaux01.dbf
      RMAN-08522: input datafile file number=00016 name=/u02/app/oracle/oradata/ORCL/4E0E6F8C1EAA259CE053F64FC40A46B6/datafile/o1_mf_sp485189_dxw3oolg_.dbf
      RMAN-08522: input datafile file number=00025 name=/u02/app/oracle/oradata/ORCL/4E0E6F8C1EAA259CE053F64FC40A46B6/datafile/o1_mf_sp245732_dxyd926s_.dbf
      RMAN-08522: input datafile file number=00034 name=/u02/app/oracle/oradata/ORCL/4E0E6F8C1EAA259CE053F64FC40A46B6/datafile/o1_mf_sp848680_dy96dc9j_.dbf
      RMAN-08522: input datafile file number=00008 name=/u02/app/oracle/oradata/ORCL/pdb1/system01.dbf
      RMAN-08522: input datafile file number=00035 name=/u02/app/oracle/oradata/SP84868041_soainfra.dbf
      RMAN-08522: input datafile file number=00017 name=/u02/app/oracle/oradata/SP485189748_soainfra.dbf
      RMAN-08522: input datafile file number=00026 name=/u02/app/oracle/oradata/SP24573291_soainfra.dbf
.
.
.
.
  RMAN-03091: Finished backup at 10-JUL-2018 10:26:47

      RMAN-03090: Starting Control File and SPFILE Autobackup at 10-JUL-2018 10:26:47
      RMAN-08503: piece handle=c-1484881322-20180710-09 comment=API Version 2.0,MMS Version 12.2.0.2
      RMAN-03091: Finished Control File and SPFILE Autobackup at 10-JUL-2018 10:27:02


      RMAN> DELETE NOPROMPT OBSOLETE;
      RMAN-06524: RMAN retention policy will be applied to the command
      RMAN-06510: RMAN retention policy is set to recovery window of 30 days
      RMAN-12016: using channel ORA_SBT_TAPE_1
      RMAN-08030: allocated channel: ORA_DISK_1
      RMAN-08500: channel ORA_DISK_1: SID=72 device type=DISK
      RMAN-06287: Deleting the following obsolete backups and copies:
      RMAN-06281: Type                 Key    Completion Time    Filename/Handle
      RMAN-06282: -------------------- ------ ------------------ --------------------
      RMAN-06284: Backup Set           27485  10-JUN-2018 00:31:10
      RMAN-06285:   Backup Piece       27485  10-JUN-2018 00:31:10 cgt5287e_1_1
.
.
...
     RMAN-03090: Starting Control File and SPFILE Autobackup at 10-JUL-2018 10:28:02
      RMAN-08503: piece handle=c-1484881322-20180710-0a comment=API Version 2.0,MMS Version 12.2.0.2
      RMAN-03091: Finished Control File and SPFILE Autobackup at 10-JUL-2018 10:28:17


      RMAN> set echo off;
      RMAN-03030: echo set off

      RMAN>

      Recovery Manager complete.
OBKUP:: ....... OK
OBKUP:: Incremental Backup to Cloud Storage is Completed
OBKUP:: Clean MOTD.
OBKUP:: Starting backup of config files
############### CFG FILES BACKUP #####################
OBKUP:: Executing rman instructions
Connection string: /u01/app/oracle/product/12.1.0/dbhome_1/bin/rman msgno target /
 -> SPOOL LOG to '/var/opt/oracle/ocde/assistants/bkup/tmp/list';
 -> list backup summary;
 -> SPOOL LOG OFF;
 ->  RMAN OUTPUT:

      Recovery Manager: Release 12.1.0.2.0 - Production on Tue Jul 10 10:28:21 2018

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

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

      RMAN>
      RMAN-03029: echo set on


      RMAN> SPOOL LOG to '/var/opt/oracle/ocde/assistants/bkup/tmp/list';RMAN> RMAN>
      RMAN-03039: Spooling for log turned off

      Recovery Manager12.1.0.2.0


      RMAN> set echo off;
      RMAN-03030: echo set off

      RMAN>

      Recovery Manager complete.
unlink /var/opt/oracle/ocde/assistants/bkup/tmp/list
unlink /var/opt/oracle/ocde/assistants/bkup/tmp/tags
rmdir /var/opt/oracle/ocde/assistants/bkup/tmp
OBKUP:: at time: 2018-07-10:10:28:02
OBKUP:: Determining the oracle database id
ownership of `/var/opt/oracle/ocde/assistants/bkup/dbid' retained as oracle:oinstall
OBKUP::  DBID: 1484881322
OBKUP:: Creating directories to store config files
OBKUP:: /u03/app/oracle/fast_recovery_area/ORCL/oscfgfiles .... OK
OBKUP:: /u03/app/oracle/fast_recovery_area/ORCL/ohcfgfiles .... OK
OBKUP:: Determining the oracle database id
ownership of `/var/opt/oracle/ocde/assistants/bkup/dbid' retained as oracle:oinstall
OBKUP::  DBID: 1484881322
 List of files to be included in tar
files to be included @ /var/opt/oracle/ocde/assistants/bkup/oscfg.spec.e: -> oscfg.spec
 -> /etc/rc.d
 -> /home/oracle/bkup
 -> /home/oracle/.bashrc
 -> /etc/crontab
 -> /etc/sysctl.conf
 -> /etc/passwd
 -> /etc/group
 -> /etc/oraInst.loc
 -> /etc/oratab
 -> /etc/fstab
 List of files to be included in tar
files to be included @ /var/opt/oracle/ocde/assistants/bkup/dbcfg.spec.e: -> dbcfg.spec
 -> dbid
 -> /u01/app/oracle/admin/ORCL/xdb_wallet
 -> /u01/app/oracle/admin/ORCL/db_wallet
 -> /u01/app/oracle/admin/ORCL/tde_wallet
 -> /u01/app/oracle/product/12.1.0/dbhome_1/dbs/opcORCL.ora
 -> /u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwORCL
 -> /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
 -> /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora
 -> /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
 -> /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib/env_rdbms.mk
 -> /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib/ins_rdbms.mk
 -> /var/opt/oracle/creg/ORCL.ini
OBKUP:: Compressing config files into tar files
OBKUP:: Uploading config files to cloud storage
Starting OSS
Logfile is /var/opt/oracle/log/oss/oss_2018-07-10_10:28:29.log
Config file is /var/opt/oracle/oss/oss.cfg

INFO: OSS Connection verified
Token is :
Uploading file /u03/app/oracle/fast_recovery_area/ORCL/oscfgfiles/2018_07_10/oscfgfiles_20180710_1028.tar.gz, you can monitor progress via /var/opt/oracle/log/oss/putfile.out
File /u03/app/oracle/fast_recovery_area/ORCL/oscfgfiles/2018_07_10/oscfgfiles_20180710_1028.tar.gz uploaded

Starting OSS
Logfile is /var/opt/oracle/log/oss/oss_2018-07-10_10:28:37.log
Config file is /var/opt/oracle/oss/oss.cfg

INFO: OSS Connection verified
Token is :
Uploading file /u03/app/oracle/fast_recovery_area/ORCL/ohcfgfiles/2018_07_10/ohcfgfiles_20180710_1028.tar.gz, you can monitor progress via /var/opt/oracle/log/oss/putfile.out
File /u03/app/oracle/fast_recovery_area/ORCL/ohcfgfiles/2018_07_10/ohcfgfiles_20180710_1028.tar.gz uploaded

changed ownership of `/u03/app/oracle/fast_recovery_area/ORCL/oscfgfiles/2018_07_10/oscfgfiles_20180710_1028.tar.gz' to oracle:oinstall
changed ownership of `/u03/app/oracle/fast_recovery_area/ORCL/ohcfgfiles/2018_07_10/ohcfgfiles_20180710_1028.tar.gz' to oracle:oinstall
OBKUP:: Completed at time: 2018-07-10:10:28:44
Cleaning backups older than 31 days
unlink /u03/app/oracle/fast_recovery_area/ORCL/oscfgfiles/2018_05_03/oscfgfiles_20180503_0118.tar.gz
unlink /u03/app/oracle/fast_recovery_area/ORCL/oscfgfiles/2018_05_03/oscfgfiles_20180503_0033.tar.gz
unlink /u03/app/oracle/fast_recovery_area/ORCL/oscfgfiles/2018_05_03/oscfgfiles_20180503_0055.tar.gz
rmdir /u03/app/oracle/fast_recovery_area/ORCL/oscfgfiles/2018_05_03
unlink /u03/app/oracle/fast_recovery_area/ORCL/oscfgfiles/2018_05_09/oscfgfiles_20180509_0153.tar.gz

unlink /u03/app/oracle/fast_recovery_area/ORCL/ohcfgfiles/2018_02_28/ohcfgfiles_20180228_1941.tar.gz
unlink /u03/app/oracle/fast_recovery_area/ORCL/ohcfgfiles/2018_02_28/ohcfgfiles_20180228_0841.tar.gz
rmdir /u03/app/oracle/fast_recovery_area/ORCL/ohcfgfiles/2018_02_28
Cleaning cfg file backups of cloud storage older than 30 days
OBKUP:: at time: 2018-07-10:10:28:44
Delete oss cfg file backup...   tahalufdbcs-1484881322/ohcfgfiles_20180227_0038.tar.gz

Delete oss cfg file backup...   tahalufdbcs-1484881322/ohcfgfiles_20180227_0140.tar.gz

Delete oss cfg file backup...   tahalufdbcs-1484881322/ohcfgfiles_20180227_0241.tar.gz

Delete oss cfg file backup...   tahalufdbcs-1484881322/ohcfgfiles_20180227_0341.tar.gz

Delete oss cfg file backup...   tahalufdbcs-1484881322/ohcfgfiles_20180227_0441.tar.gz

Delete oss cfg file backup...   tahalufdbcs-1484881322/ohcfgfiles_20180227_0540.tar.gz
.
.
..
.
OBKUP:: Config files backup ended successfully
OBKUP:: Clean MOTD.
OBKUP:: All requested tasks are completed
############################### BACKUP COMPLETED SUCCESSFULLY ##############################


Number of Visitors