Monday, April 29, 2013

step by step to setup Oracle instant client and Oracle express 11

First, go to Oracle web site to download rpm files used below.
Below is just a raw copy of steps for installing Oracle instant client and Oracle Express 11 on a CentOS 64 machine.
19:45 yiyujia@localhost:~ $ hostname
localhost.localdomain
19:45 yiyujia@localhost:~ $ su
Password: 
[root@localhost yiyujia]# rpm -ivh /home/yiyujia/Downloads/oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:oracle-instantclient11.########################################### [100%]
[root@localhost yiyujia]# rpm -ivh /home/yiyujia/Downloads/oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:oracle-instantclient11.########################################### [100%]
[root@localhost yiyujia]# rpm -ivh /home/yiyujia/Downloads/oracle-instantclient11.2-odbc-11.2.0.4.0-1.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:oracle-instantclient11.########################################### [100%]
[root@localhost yiyujia]# rpm -ivh /home/yiyujia/Downloads/Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:oracle-xe              ########################################### [100%]
Executing post-install steps...
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.

[root@localhost yiyujia]# /etc/init.d/oracle-xe configure

Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express 
Edition.  The following questions will determine whether the database should 
be starting upon system boot, the ports it will use, and the passwords that 
will be used for database accounts.  Press  to accept the defaults. 
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:8888

Specify a port that will be used for the database listener [1521]:

Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of 
different passwords for each database account.  This can be done after 
initial configuration:
Confirm the password:

Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:n

Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.
[root@localhost yiyujia]# rpm -ivh /home/yiyujia/Downloads/sqldeveloper-3.2.20.09.87-1.noarch.rpm 
Preparing...                ########################################### [100%]
   1:sqldeveloper           ########################################### [100%]
[root@localhost yiyujia]# source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh 
[root@localhost yiyujia]# vi /etc/bashrc
#export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib:/usr/local/lib
#source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
[root@localhost yiyujia]# usermod -a -G oracle yiyujia
usermod: group 'oracle' does not exist
[root@localhost yiyujia]# usermod -a -G dba yiyujia
[root@localhost yiyujia]# usermod -a -G dba root
[root@localhost yiyujia]# exit
exit
21:11 yiyujia@localhost:~ $ sqlplus / as sysdba
bash: sqlplus: command not found
21:11 yiyujia@localhost:~ $ source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh

21:11 yiyujia@localhost:~ $ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Tue Oct 29 21:11:55 2013

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


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> select * from v$database;                                     

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------
2711238071 XE      29-OCT-13      353178 29-OCT-13

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------
        1 28-AUG-11    NOARCHIVELOG      357224

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------
       0 CURRENT 29-OCT-13        430

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------
      357257 29-OCT-13        NOT ALLOWED 29-OCT-13

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------
READ WRITE      MAXIMUM PERFORMANCE  UNPROTECTED        ENABLED

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------
 2711229879  2711229879 PRIMARY      0 DISABLED

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------
NOT ALLOWED      DISABLED NONE    NO       NO  NO  NO     13

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------
Linux x86 64-bit

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------
      2     2  358239

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------
NO     NO  NO  XE

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------
    0 DISABLED

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------
      0

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------


      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------
NO       NO

      DBID NAME      CREATED  RESETLOGS_CHANGE# RESETLOGS_TIME
---------- --------- ------------------ ----------------- ------------------
PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI LOG_MODE CHECKPOINT_CHANGE#
----------------------- ------------------ ------------ ------------------
ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
--------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME   OPEN_RESETL VERSION_TIME
------------------- ------------------ ----------- ------------------
OPEN_MODE      PROTECTION_MODE   PROTECTION_LEVEL     REMOTE_A
-------------------- -------------------- -------------------- --------
ACTIVATION# SWITCHOVER# DATABASE_ROLE  ARCHIVELOG_CHANGE# ARCHIVEL
----------- ----------- ---------------- ------------------ --------
SWITCHOVER_STATUS    DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
-------------------- -------- ------- -------- --- --- --- -----------
PLATFORM_NAME
--------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN
---------------------------- ---------------------- -----------
FLASHBACK_ON    SUP SUP DB_UNIQUE_NAME
------------------ --- --- ------------------------------
STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_STATUS   FS_FAILOVER_CURRENT_TARGET
-------------------------- ---------------------- ------------------------------
FS_FAILOVER_THRESHOLD FS_FAIL
--------------------- -------
FS_FAILOVER_OBSERVER_HOST
--------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME    SUP MIN_REQUIRED_CAPTURE_CHANGE#
--- ------------------------------ --- ----------------------------


SQL> 



Add new user for SQL Developer to use for connecting.

23:45 yiyujia@localhost:~ $ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Tue Oct 29 23:51:40 2013

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


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size      2233344 bytes
Variable Size    616565760 bytes
Database Buffers   444596224 bytes
Redo Buffers      5541888 bytes
Database mounted.
Database opened.
SQL> create user yiyujia identified by 123456;

User created.

SQL> grant dba to yiyujia;

Grant succeeded.


Saturday, April 20, 2013

How to reconfigure Oracle Express listeners after changing hostname

After the computer has hostname changed, the Oracle Express 11 may not work as its configuration still point to old hostname. Hostname may be changed when the machine's network work status is changed. For example, I used NAT mode for my virtual machine. After I change its NIC to have Bridge mode, the hostname may be changed. Here is my steps to reconfigure Oracle Express listeners to bind on new hostname.

  1. Run “hostname” to get your server's new hostname from DNS server.
  2. Run “cd /u01/app/oracle/product/11.2.0/xe/network/admin”
  3. Replace “localhost.localdomain” in file listener.ora with your new hostname.
  4. Replace “localhost.localdomain” in file tnsnames.ora with your new hostname.
  5. tnsping yurNewHostName and see XE instance is running.