Micromeritics - Fundamental and Derived Properties of Powders
Oracle backup
1. PREPARED BY RAVI KUMAR LANKE Page 1
ORACLE BACKUP
Backing up an Oracle database can be done in many different ways and is quite difficult to get a
grasp on compared to other mainstream databases. Backup is best done through RMAN whether
you access RMAN from a command line interface (CLI) or from within Oracle Enterprise
Manager (GUI)
Oracle versions tested here:
1. Oracle 11gR2 on Windows/Linux/Solaris
2. Oracle Express 10g XE on Windows/Linux
Configure Oracle backup environment - using Enterprise
Manager (GUI)
Before you start taking backup, you should configure your backup environment. Here is how to
configure the Oracle backup environment using Enterprise Manager.
2. PREPARED BY RAVI KUMAR LANKE Page 2
Log on to Enterprise Manager as 'sys as sysdba'.
3. PREPARED BY RAVI KUMAR LANKE Page 3
Go to "Availability tab > Backup/Recovery > Backup Settings".
6. PREPARED BY RAVI KUMAR LANKE Page 6
Under the "Device" tab set :
1. Disk backup location. If you change the from default (the fast recovery area), you need to
point to an existing directory
2. Choose backup type :
o Backup Set (default) : will create backup files in a format that only RMAN
understands.
o Image Copy : will create backup files corresponding to the files that make up the
database, that is : 5 data files (prefixed DATA_), a copy of the SPFILE, a copy of
the Control file and if in ARCHIVELOG mode also a number of redo files
(prefixed ARCH_).
3. Enter host credentials (the user who installed Oracle).
4. press the 'Test Disk Backup' button to confirm it works.
3.
4. If you are on Solaris you may get Connection to host as user oracle failed:
ERROR: NMO not setuid-root (Unix-only). If you get that error then:
1. Open a shell as root
2. #> su oracle : switch to user oracle.
3. $> emctl stop dbconsole : stop the dbconsole.
4. $> exit : back to root user.
5. #> ORACLE_OWNER=oracle : initialize the ORACLE_OWNER
variable.
6. #> export ORACLE_OWNER : add the ORACLE_OWNER to the root
environment.
7. #> cd $ORACLE_HOME :
8. #> ./root.sh : execute the root.sh script and answer yes to all prompts.
9. #> su oracle : switch to user oracle.
10. $> emctl start dbconsole : start the dbconsole.
11. Try the "Test Disk Backup" button again.
5. Press the OK button to save the settings
4. Under the Backup Set tab there is no settings necessary to set
5. Under the Policy tab it is possible to tune the backup, however I feel the backup result
files become less independent and I choose to skip optimize options. The Retention
Policy I like to choose the default "Retain at least the specified number of full backups
for each datafile" with a value of 1. This is because it then gives meaning to let a 3. party
backup program copy the backup result to a remote backup store and handle the retention
period outside of Enterprise Manager control.
You are now ready to do backup.
7. PREPARED BY RAVI KUMAR LANKE Page 7
Backup Oracle - using RMAN (CLI) -
Windows/Linux/Solaris
The RMAN backup procedure depends on whether your Oracle database is in ARCHIVELOG or
NOARCHIVELOG mode, therefore start by checking the log_mode :
1. Open a command prompt
2. shell> sqlplus / as sysdba : start SQL*Plus and log in as sysdba
3. sql> select log_name from v$database; : will display whether you are in ARCHIVELOG or
NOARCHIVELOG mode
4. sql> exit
Now that you know your log_mode, ARCHIVELOG or NOARCHIVELOG, you can choose the
appropiate step-by-step procedure :
If in ARCHIVELOG mode :
The backup is quite simple because you can take the backup while the database is open (online
backup)
1. Open a shell.
2. shell> rman target / : logon to RMAN using host credentials.
3. rman> show all; : shows the environment configuration (that can be setup using the
"Enterprise Manager > Availability tab > Backup/Recovery > Backup Settings")
4. rman> backup database plus archivelog; : start backup and include the archivelog since
they are needed to secure a consistent restore
5. rman> exit : you are finished.
8. PREPARED BY RAVI KUMAR LANKE Page 8
If in NOARCHIVELOG mode :
The backup is less simple because you need to be sure the database is in a consistent state and
then mount the database without opening it (offline backup)
1. Open a shell.
2. shell> rman target / : logon to RMAN using host credentials.
3. rman> shutdown immediate; : shutdown and rollback pending transactions (without the
immediate keyword, the shutdown will wait for all pending transactions to finish)
4. rman> startup mount; : startup and mount the database but without opening it
(datafiles location will be known but not loaded).
5. rman> show all; : shows the environment configuration you did under Configure Oracle
backup environment.
6. Depending on configured Backup type : ("Enterprise Manager > Availability tab >
Backup/Recovery > Backup Settings")
rman> backup database; : if Backup type = Backup Set (default).
rman> backup as copy database; : if Backup type = Image Copy.
7. rman> alter database open; : open the database (the datafiles will be loaded and the
database therefore online).
8. rman> exit : you are finished.
The database is now backed up and the resulting backup files located in the Disk backup location
(specified then configuring the Oracle backup environment).
The resulting backup files could then be copied to some remote storage location for increased
security (eg. if the Disk backup location is on the same harddisk as the live datafiles and that
harddisk fails, then the backup is not going to help)
9. PREPARED BY RAVI KUMAR LANKE Page 9
Backup Oracle - using Enterprise Manager (GUI) -
Windows/Linux/Solaris
Note that Enterprise Manager is only a GUI on top of RMAN.
Log on to Enterprise Manager as 'sys as sysdba'
10. PREPARED BY RAVI KUMAR LANKE Page 10
Go to "Availability tab > Backup/Recovery > Schedule Backup
11. PREPARED BY RAVI KUMAR LANKE Page 11
On the "Schedule Backup" page you can choose between "Schedule Oracle Suggested Backup"
and "Schedule Customized Backup". The main difference between the two is that "Schedule
customized backup" allows you to :
Choose between an immediate non-scheduled backup or a scheduled backup.
Override default backup environment settings
12. PREPARED BY RAVI KUMAR LANKE Page 12
Since Oracle suggested backup don't offer any significant convenience, press the "Schedule Customized
Backup" button.
On the "Options" page accept default "Full Backup" and press the "Next" button
13. PREPARED BY RAVI KUMAR LANKE Page 13
On the "Settings" page the defaults will depend on your Oracle environment configuration, however in
case of an immediate single backup you maybe want to change the settings in which case you press the
"Override default settings" button. Then you are happy, press the "Next" button
14. PREPARED BY RAVI KUMAR LANKE Page 14
On the "Schedule" page, the job needs a name, a description and a schedule (here One Time
Immediately). Press the "Next" button.
Press the "Submit Job" button
You now have a backup in your designated backup folder. Best to copy that backup to a remote storage,
so that if your harddrive fails, you still have a copy of the backup files
15. PREPARED BY RAVI KUMAR LANKE Page 15
Backup Oracle - using Flashback - Windows/Linux/Solaris
Flashback is not available in all editions.
In editions containing Flashback, Flashback is disabled by default. However, if you have
Flashback and you have the disk space, then Flashback is important to enable because it is a
more efficient alternative to DBPITR (DataBase Point-In-Time Recovery), that is: then a
database needs to roll back because of unwanted changes eg. a user have overwritten data or an
administrator have dropped a table.
As with DBPITR, Flashback cannot be used in case of media errors, eg. data file corruption.
If Flashback is enabled, the database will continously write data file blocks to the flashback logs
as well as create, delete and resize them. Flashback logs are not archived and cannot be backed
up to disk.
First check if flashback is already turned on :
1. Open a shell.
2. #> su oracle : ONLY Solaris : if you have opened a shell as root, you may not be able to use
SQL*Plus, so better switch user to oracle.
3. shell> sqlplus / as sysdba : logon to SQL*Plus as sydba.
4. sql> select flashback_on from v$database; : you will get either YES or NO.
If Flashback is not enabled, you can enable Flashback using either SQL*Plus or Enterprise Manager :
16. PREPARED BY RAVI KUMAR LANKE Page 16
Enable Flashback using SQL*Plus (CLI) :
1. Open a shell.
2. shell> sqlplus / as sysdba : logon to SQL*Plus as sysdba.
3. sql> alter database set db_flashback_retention_target=4320; : setting flashback
retention to 3 days (default is 1440 minutes = 1 day). If fast recovery area disk constraint
allows it, this will make it possible to look 3 days into the past
4. sql> alter database flashback on; : enable flashback. If you get error ORA-38703: Media
recovery is not enabled, then you are most likely in NOARCHIVELOG mode.
sql> select log_mode from v$database; : confirm your log mode. If you are in
NOARCHIVELOG and you want to change to ARCHIVELOG so that you can enable
Flashback :
1. sql> shutdown immediate; :
2. sql> startup mount; :
3. sql> alter database archivelog; :
4. sql> alter database open; :
5. sql> alter database flashback on; : this time you should be able to
enable flashback.
17. PREPARED BY RAVI KUMAR LANKE Page 17
Enable Flashback using Enterprise Manager (GUI) :
Log on to Enterprise Manager as 'sys as sysdba'.
18. PREPARED BY RAVI KUMAR LANKE Page 18
On the Availability tab click on the "Recovery Settings" link
19. PREPARED BY RAVI KUMAR LANKE Page 19
On the Recovery Settings page :
20. PREPARED BY RAVI KUMAR LANKE Page 20
1. Be sure ARCHIVELOG mode is enabled - it is not possible to enable Flashback in
NOARCHIVELOG mode.
2. "Flash Recovery Area Size" is the maximum space allocated for Flashback logs, therefor
if set too low, it will cap your Flashback Retention Time. (The size of the flashback log is
approximately the same as the size of the redo log files, so if the flashback retention is 3
days, then the size of the flashback logs will be 3 times that of the redo logs).
3. Check the "Enable Flashback Database", this it what we came here for.
4. "Flashback Retention Time" is the time you will be able to roll your database back. If set
to default 24 hours and you found out that a user overwrote data 25 hours ago, you will
not be able to use Flashback to get the overwritten data back.
Disable Flashback using SQL*Plus (CLI) :
21. PREPARED BY RAVI KUMAR LANKE Page 21
(just here for completness)
1. Open a shell.
2. shell> sqlplus / as sysdba : logon to SQL*Plus as sysdba.
3. sql> alter database flashback off; : disable Flashback.
Flashback should now be enabled
Backup Oracle - using Export - Windows/Linux/solaris
Oracles Export (exp) & Import (imp) utilities are popular for backup of Oracle databases smaller
than say 50 GB (which is bigger than most databases). The reason they are so popular is because
they are both easy and versatile.
Oracles Export & Import utilities are used for the following tasks :
Database backup - what we will do here
Reducing fragmentation in the database.
Move data from one owner to another.
Move data from one version to another, eg. from version 9i to 11g.
Moving the database from one operation system to another, eg. from Solaris to Windows.
Oracles Export & Import utilities are called exp & imp respectively, however from version 10,
Oracle introduced the DataPump utilities called expdp & impdp respectively. The DataPump
utilities should be superiour eg. faster and with support for network. The old exp & imp utilities
can still be used with Oracle 11gR2.
The DataPump utilities, expdp & impdp, works right away, however the old export/import
utilities, exp & imp, needs to be prepared by runnning the catexp.sql script :
1. Open a shell
2. shell> sqlplus / as sysdba : logon to SQL*Plus as sys as sysdba using host credentials
3. Execute the catexp.sql script :
o Windows : sql> @?rdbmsadmincatexp.sql : @ executes a script and ? points to
%ORACLE_HOME%.
o Solaris/Linux : sql> @?/rdbms/admin/catexp.sql : @ executes a script and ?
points to $ORACLE_HOME.
The exp utility can be used in 3 different modes : (from the shell)
22. PREPARED BY RAVI KUMAR LANKE Page 22
Interactive prompt : (holding your hand)
shell> exp : start the interactive prompt
23. PREPARED BY RAVI KUMAR LANKE Page 23
ogin. Here i use the same user as I want to export, however you can also use sys as sysdba
24. PREPARED BY RAVI KUMAR LANKE Page 24
specify the dump file location
25. PREPARED BY RAVI KUMAR LANKE Page 25
specify how to choose objects - here I want to export all objects for specific users
35. PREPARED BY RAVI KUMAR LANKE Page 35
Standard command line : (fast dump on-the-fly)
o shell> exp scott/tiger file=scott.dmp : fast dumping all objects belonging to scott
(note that scott/tiger is the credentials used to login to the exp utility - it is just
default that you will then export the scott objects if nothing else specified)
o shell> exp scott/tiger file=scott.dmp log=scott.log : fast dumping all objects
belonging to scott and also a log file to see how the export went
o shell> exp scott/tiger file=scott.dmp log=scott.log tables=(tbl1,tbl2) : dumping
only the tables tbl1 & tbl2 (these tables must belong to scott) and a log file.
o shell> exp scott/tiger file=scott.dmp log=scott.log tables=(tbl1,tbl2) rows=no :
dumping only the structures (not the data) of tables tbl1 & tbl2 and a log file.
Command line with parameter file : (if you need many parameters and you need to do
it often)
o no examples
36. PREPARED BY RAVI KUMAR LANKE Page 36
Appendix : SQL*Plus & RMAN : logon & management
commands
Logon to SQL*Plus (no normal logon for user sys - either use as sysdba or as sysoper)
o shell> sqlplus / as sysdba : logon to SQL*Plus as sys as sysdba using host
credentials.
o shell> sqlplus sys/SysPassword as sysdba : logon to SQL*Plus as sys as sysdba
using sys password.
o shell> sqlplus scott/tiger : logon to SQL*Plus as scott who have the password
tiger.
Logon to RMAN :
o shell> rman target / : logon to RMAN using host credentials.
o shell> rman : start the RMAN shell to logon from within RMAN :
rman> connect target sys@orcl : format user@dbname.
rman> connect target sys@ipadress/orcl : format user@ipaddress/dbname.
rman> connect target sys@localhost/orcl) : format user@host/dbname.
SQL*Plus management commands (most will require that you are logged on as sysdba)
o Managing database :
sql> shutdown : database will wait for all pending transactions to commit,
then close, then dismount, then shutdown.
sql> shutdown immediate : instead of waiting to commit all pending
transactions, Oracle will roll them all back - fast shutdown.
sql> startup nomount : will start the database instance but not mount it.
Then issuing the startup command, Oracle will read the initalization
parameter file (init.ora or spfile) to get database configuration eg. size of
all memory areas which will then be allocated and all background
processes will be started and together these processes and allocated
memory is called an Oracle instance and that instance is now started.
sql> startup mount : will start and then mount the database but not open it.
In the mount stage, the control file is read to locate the datafiles but
without opening them (without making access possible) - the instance is
now mounted. Obviously this is the right stage in which to take backup
since the datafile locations are now known and most likely consistent
(except for online backup that qua log files do not need consistent
datafiles).
sql> startup : will start, mount and open the database. An open database is
also called an online database and makes it possible to access the datafiles
through Oracle eg. using sql (Stages in starting an Oracle database).
sql> alter database mount; : change a nomounted to mounted.
sql> alter database open; : change a mounted not opened to opened.
sql> alter database open resetlogs; : change a mounted not opened to
opened and starts a new incarnation.
sql> select name from v$database; : find the name of your database.
37. PREPARED BY RAVI KUMAR LANKE Page 37
sql> select log_mode from v$database; : find out if your database is in
ARCHIVELOG or NOARCHIVELOG mode.
sql> select open_mode from v$database; : show access, eg. OPEN
WRITE (gives error ORA-01034: ORACLE not available if the instance is
not started).
sql> show parameters CONTROL_FILES; : find the path to your control
files.
sql> select * from v$database_incarnation; : list all incarnations, however
RMAN creates a more nice list :
rman> list incarnation;
sql> select value$ from sys.props$ where name =
'NLS_CHARACTERSET'; : shows the database ordinary characterset.
sql> select * from nls_database_parameters; : shows additional language
information. NSL_CHARACTERSET is ordinary and
NLS__NCHAR_CHARACTERSET is national characterset.
sql> alter database character set WE8MSWIN1252; : changes the
characterset to WE8MSWIN1252 - note if the new character is not a
superset of the old, you will get ora-12712: new character set must be a
superset of old character set.
(Official Character set Migration should be consulted).
o Managing users :
sql> select * from all_users; : fast list of all users.
sql> select username, user_id, account_status from dba_users order by
username; : dba_users contains quite a lot more info than all_users.
sql> select user#, name from sys.user$; : more users and more info.
sql> create user rasmus identified by myPassword; : creating a user called
rasmus with the password myPassword.
sql> alter user rasmus identified by newPassword; : change the password
for rasmus from myPassword to newPassword.
sql> grant connect to rasmus; : granting rasmus connect privilege.
sql> create tablespace tsrasmus datafile 'C:apporadataorcltsrasmus.dbf'
size 20M;create a tablespace with a 20 MB datafile.
sql> alter user rasmus default tablespace tsrasmus quota unlimited on
tsrasmus; : specify that rasmus default should store objects in tsrasmus
instead of in the user tablespace.
sql> alter user rasmus account unlock; : unlock the rasmus user account.
sql> drop user rasmus cascade; : deleting the rasmus user. Specify cascade
to also delete all objects belonging to rasmus.
o Managing tables :
sql> desc dba_users; : show the structure of the dba_users table.
sql> select * from cat; : shows all tables belonging to current user.
sql> select table_name from dictionary; have less tables but more
information.
sql> select table_name from dba_tables; : shows all tables in the database
regardless of user and having a lot of info.
38. PREPARED BY RAVI KUMAR LANKE Page 38
sql> select owner, table_name, tablespace_name from dba_tables where
owner = 'RASMUS'; : show all tables and there they are stored for the
rasmus user.
sql> create table employees (firstname varchar2(100), age number); :
creating a table called employees.
sql> drop table employees; : deleting the employees table.
o Managing SQL*Plus :
sql> show all; : show all SQL*Plus settings.
sql> help topics; : list all topics that there are help for.
sql> @myscript.sql : executes myscript.sql which must be in the current
directory
sql> @C:appproductdbhome_1rdbmsadmincatexp.sql : if the script is
not in current directory, then specify the full path.
sql> @?rdbmsadmincatexp.sql : ? is a shorthand for
%ORACLE_HOME% (windows) or $ORACLE_HOME (solaris/linux).
sql> ed myscript.sql; : starts an associated text editor and opens op
myscript.sql from current directory.
sql> define; : will show all defined variables.
sql> define rasmus=programmer : declare a new variable called rasmus
and initializes it with the value programmer.
sql> undefine rasmus; :
Appendix : Oracle backup related concepts :
RMAN : Recovery MANager command utility. Preferred to to backup & restore Oracle
databases as it provides an OS independent interface as well as removes OS dependencies
in the backup files
RMAN Repository : records of database files and backups for each database on which
RMAN performs operations. These meta data are stored in the control file of the target
database, therefore you should always backup the control file.
Enterprise Manager : (normally abbreviated EM or OEM) : Web application to manage
Oracle. It is possible to perform and schedule backups using EM (EM backup will use
RMAN underneath and as such EM is a GUI frontend to RMAN)
Fast Recovery Area : (earlier named flash recovery area). A directory to store recovery
related files such as control file, online redo log copies, archived redo log files, flashback
logs and RMAN backups. Oracle & RMAN automatically manage the files in this
directory, eg. automatically delete files that are no longer needed.
Oracle Flashback : Oracle Flashback is built-in to some but not all Oracle database
editions and enables you to recover data from unwanted database changes without
restoring files from backup or performing media recovery - this feature relies on undo
data. Flashback must be turned on though and can be turned on for individual tables and a
retention period must be specified, this will create a flashback data archive.
SCN : System Change Number : Everytime a transaction is committed, Oracle records a
new SCN. Then Oracle starts up, Oracle check SCN in all datafile headers and in the
39. PREPARED BY RAVI KUMAR LANKE Page 39
control file and if they are all the same then the database is consistent. If they are not the
same, the database is in need of recovery.
Offline Backup : (sometimes called cold backup) backups that run when the database is
in the mounted but not open state. Oracle in NOARCHIVELOG log_mode must do
offline backup
Online Backup : (sometimes called hot backup) backups that run when the database is in
open state. Oracle in ARCHIVELOG log_mode can do online backup
log_mode : Oracle can be in either ARCHIVELOG or NOARCHIVELOG log_mode.
The ARCHIVELOG have 2 advantages
o Oracle can do Online Backup
o Oracle can restore ALL committed data to the point of failure as opposed to
NOARCHIVELOG log_mode there Oracle restore will loose all data committed
since the last backup
Physical >< Logical Backup : Physical backup refers to the files making up the database
while Logical backup referes to data, tables etc. Oracle backup is mostly physical backup
Backing up a database : means to make copies of the data files, control file and if in
ARCHIVELOG mode then also copies of archived redo log files
Restoring a database : means copying the physical files that comprise the database from
a backup medium (disk or tape) to their original or to new locations
Database recovery : is the process of updating database files restored from a backup
with the changes made to the database after the backup (typically using the redo log files)
Media Recovery : most often used to recover from media failure, eg. loss of a file or disk
or a user error eg. deletion of the contents of a table. Media recovery requires a control
file, data filees (typically restored from backup) and online and archived redo log files
(that contains the changes since the time the data files were backed up.
Control file : contains among other things names & locations of data files and online &
archive log records and backup records. Also without the control file, the database cannot
be mounted and therefore recovery cannot be performed - you need to backup the control
file.
SPFILE : Server Parameter file : A binary parameter file that Oracle is using upon
startup (alternatively a text based PFILE can be used). The name of the SPFILE may be
spfileSID.ora, where SID is the database name (PFILE nomenclature is initSID.ora). If no
parameter file can be found, Oracle cannot start up.
Table spaces : Logical storage unit (logical because there is no file representation on the
file system) used to organizing objects. A table space have at least one data file and a data
file can only belong to one table space. Tables, indexes etc. belongs to a tablespace.
Table spaces can be created, but then a database is created it will be created with 5
default table spaces : system, sysaux, temp, undotbs1 & users.
Data files : Physical representation of the table spaces, that is: data files physically holds
the data.
Schema : Collection of objects owned by a user of the same name. Eg if the user is
Rasmus, then all objects like tables, views, indexes etc. owned by Rasmus is collected in
a Schema named Rasmus.
Management Repository Encryption key : If Enterprise Manager data is encrypted
(Management Repository has been placed in secure mode), then this key MUST be
40. PREPARED BY RAVI KUMAR LANKE Page 40
backed up as the encrypted data will become unusable if this file is lost. Location is :
/export/home/oracle/app/oracle/product/11.2.0/dbhome_1/localhost_orcl/sysman/config/e
mkey.ora.
Appendix : default Oracle file locations
Below USER_NAME is the user that installed Oracle.
Fast Recovery Area (called flash recovery area on Oracle Express XE 10g)
o Oracle 11gR2 on Windows :
C:appUSER_NAMEflash_recovery_areaDB_NAME
o Oracle 11gR2 on Solaris : /export/home/oracle/app/oracle/flash_recovery_area
o Oracle Express XE 10g on Windows :
C:oraclexeapporacleflash_recovery_areaXE
o Oracle Express XE 10g on Linux :
/usr/lib/oracle/xe/app/oracle/flash_recovery_area/
Data files :
o Oracle 11gR2 on Windows : C:appUSER_NAMEoradataDB_NAME
o Oracle 11gR2 on Solaris : /export/home/oracle/app/oracle/oradata/??
Installation files :
o Oracle 11gR2 on Solaris :
/export/home/oracle/app/oraInventory/PRODUCT_NAME
Control file :
o Oracle 11gR2 on Windows : C:appUSER_NAMEoradataDB_NAME (same
place as the data files)
SPFILE :
o Oracle 11gR2 on Solaris :
/export/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileorcl.ora
listener.ora & tnsnames.ora :
o Oracle 11gR2 on Solaris :
/export/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin
oratab : (defines home folders for each database instance in the format SID:FOLDER)
o Oracle 11gR2 on Solaris : /var/opt/oracle/oratab
o Oracle 11gR2 on Linux : /var/oratab
Environment Variables :
o Oracle 11gR2 on Solaris $ORACLE_BASE : /export/home/oracle/app/oracle
o Oracle 11gR2 on Solaris $ORACLE_HOME :
/export/home/oracle/app/oracle/product/11.2.0/dbhome_1
o Oracle 11gR2 on Solaris $ORACLE_OWNER : oracle
o Oracle 11gR2 on Solaris $ORACLE_SID : orcl
41. PREPARED BY RAVI KUMAR LANKE Page 41
Appendix : Common errors & Solutions
1. c:> emctl dbconsole status : errors EM Configuration issue.
c:appUSERNAMEproduct11.2.0dbhome_1/HOSTNAME_DBNAME not found
2. $> emctl dbconsole status : errors EM Configuration issue.
/export/home/app/oracle/product/aa.2.0/dbhome_1/HOSTNAME_DBNAME not found
3. $> emctl dbconsole start : exactly the same error as 2.
4. $> emctl start dbconsole : errors OC4J Configuration issue.
.../oc4j/j2ee/OC4J_DBConsole_HOSTNAME_DBNAME not found
Reason : If you have one of the above errors, 1, 2, 3 or 4, you have most likely not set the
$ORACLE_HOSTNAME environment variable. The problem is that the Oracle installer will use
localhost for HOSTNAME at least then installing a desktop class system. However, then services
start, Oracle will match hostname with $ORACLE_HOSTNAME and if
$ORACLE_HOSTNAME is empty then substitute with the system hostname, which likely is
different from localhost.
Example : If your hostname is Solaris10 and your database name is orcl, then emctl will search
for ../oc4j/j2ee/OC4J_DBConsole_Solaris10_orcl, but the installer created
../oc4j/j2ee/OC4J_DBConsole_localhost_orcl.
Solution : There are different possible solutions of which by far the easiest is to set the
$ORACLE_HOSTNAME to localhost :
1. On Windows
1. Open a shell.
2. c:> set ORACLE_HOSTNAME=localhost : declare, initialize and add the
variable to your environment
3. c:> echo %ORACLE_HOSTNAME% : confirm the variable - you should get
localhost.
2. On Solaris
1. Open a shell.
2. #> ORACLE_HOSTNAME=localhost : declare & initialize the variable.
3. #> export ORACLE_HOSTNAME : add the variable to your environment.
4. #> echo $ORACLE_HOSTNAME : confirm the variable - you should get
localhost.
42. PREPARED BY RAVI KUMAR LANKE Page 42
To persist $ORACLE_HOSTNAME on system boot (Solaris), please see here (step 9).
5. c:> emctl dbconsole status : errors Environment variable ORACLE_UNQNAME not
defined. Please set ORACLE_UNQNAME to database unique name.
Solution : Set the ORACLE_UNQNAME to the value of your database name :
On Windows
1. Open a shell.
2. c:> set ORACLE_UNQNAME=orcl : declare, initialize and add the variable to
your environment
3. c:> echo %ORACLE_UNQNAME% : confirm the variable - you should get orcl.
On Solaris
1. Open a shell.
2. #> ORACLE_UNQNAME=localhost : declare & initialize the variable.
3. #> export ORACLE_UNQNAME : add the variable to your environment.
4. #> echo $ORACLE_UNQNAME : confirm the variable - you should get orcl.
Enterprise Manager cannot connect.
43. PREPARED BY RAVI KUMAR LANKE Page 43
Solution : This solution worked for me. If it does not work for you, you can read more here
1. On Windows
1. Open a shell.
2. c:> set ORACLE_SID=orcl : declare, initialize and add the variable to your
environment
3. c:> emca -deconfig dbconsole db : you will be prompted for your database name.
4. c:> emca -config dbconsole db : you will be prompted for dbname, several
passwords, ORACLE_HOME and Listener port number (default 1521).
5. Refresh Enterprise Manager in your browser.
44. PREPARED BY RAVI KUMAR LANKE Page 44
sql> alter database open; : errors ORA-38760: This database instance failed to turn on flashback
database
Solution : Turning flashback off and then on should solve the problem, however any guaranteed
restore point need to dropped.
1. You should already be in your SQL*Plus shell.
2. Be sure your database is started and in mounted stage :
1. sql> shutdown immediate;
2. sql> startup mount;
3. Check for quaranteed restore points and delete them if found :
1. sql> select name, scn, guarantee_flashback_database, database_incarnation# from
v$restore_point; : list your restore points.
2. If you found any then drop them
Example: sql> drop restore point RESTORE_POINT_NAME;.
4. sql> alter database flashback off; : turn off flashback.
5. sql> alter database flashback on; : turn on flashback.
6. sql> alter database open; : this time you should succeed.
Enterprise Manager import/export give error ORA-20446: The owner of the job is not registered ORA-
06512: at "SYSMAN.MGMT_JOBS", line 168 ORA-06512: at "SYSMAN.MGMT_JOBS", line 86 ORA-06512:
at line 1.
45. PREPARED BY RAVI KUMAR LANKE Page 45
Reason : This is likely a bug in Oracle 11g
Solution :
1. On Windows/Solaris/Linux
1. Open a shell.
2. shell> sqlplus sysman/SysmanPassword : logon to SQL*Plus as SYSMAN.
3. sql> execute MGMT_USER.MAKE_EM_USER(‘USERID’); : USERID is the
user that you use to login to Enterprise Manager then doing import/export.
4. Try running import/export again.