Thursday, April 23, 2015

Change the Database SID


I am using Oracle Enterprise Linux 6.5 and Database version is 11.2.0.4
Initially My Database SID is ORCL  and I want it to change to ORCL2

Step 1 - You need to Back up the database using RMAN backup set or exp full back up

Step 2 -Mount it after clean shut down.
sql>shutdown immediate
sql>startup mount

Step 3 -Create pfile from the spfile;
sql>create pfile from spfile;

Step 4 -Use DBNEWID utility to change the DBNAME.Use SYSDBA privileges username and password and dbname parameter is the new DBname.
os>nid target=sys/oracle dbname=SAM2































Step 5 - shutdown the database
sql>shutdown immediate

Step 6 -Modify the DB_NAME parameter in the initialization parameter file
use either  one of methods

Method A
Directly edit initORCL.ora file  in $ORACLE_HOME\dbs location.
initORCL.ora
DB_NAME=ORCL2
startup mount pfile=' initORCL.ora'

Method B
The startup will result in an error but proceed anyway.
startup mount
alter system set db_name=ORCL2 scope=spfile;
shutdown immediate


Step 7 - Create a new password file:
os>orapwd file=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/pwdORCL2.ora password=password entries=10

Step 8- Rename the spfile init file to match the new name.

Step 9-Change the environment for the new DB NAME
export ORACLE_SID=ORCL2;

Step 10 - Alter the listener.ora and tnsnames.ora setting to match the new database name and restart the listener:

lsnrctl reload

ORCL2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCL2)
    )
  )

 Step 11 -
Open the database with RESETLOGS:

startup mount
alter database open resetlogs;

Step 12 - Backup the database.

Tuesday, April 21, 2015

Install Dbvisit without configuring mail.

Please  set the  parameters as follows  in  the dbv_ORCL.env file (dbv_ORACLE_SID.env) which is located in


C:\Program Files (x86)\Dbvisit\Standby\conf



#--------------------------------------------------------------------------
SEND_MAIL_FLAG = N
SEND_MAIL_FLAG_DR = N

#--------------------------------------------------------------------------


#==============================================================================
# ==> Mail settings.
#==============================================================================
[40 Mail Settings]
SUCCESSMAIL = N
SUCCESSMAIL_DR = N
ADMINS = N
MAILCFG_FROM = N
MAILCFG_FROM_DR = N
MAILCFG_SMTP_SERVER = N
MAILCFG_SMTP_SERVER_DR = N

Wednesday, April 1, 2015

Export with No Data.Only Table structure.

When exporting you have to mention ROWS=N in the  exp command


[oracle@testdb backup]$ exp test/test FILE=ods.dmp LOG=ods.log ROWS=N

Export: Release 11.2.0.4.0 - Production on Wed Apr 1 09:25:47 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
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8MSWIN1252 character set (possible charset conversion)
Note: table data (rows) will not be exported
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user TEST
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user TEST
About to export TEST's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export TEST's tables via Conventional Path ...
. . exporting table                             T1
. . exporting table                             T2
. . exporting table                             T3
. . exporting table                             T4
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.



------------------------------------------------------------------------------------------------------------------------
Import above backup  (DMP)with another user test2

[oracle@testdb backup]$ imp userid=test2/test2 FILE=ods.dmp LOG=impods.log GRANTS=N IGNORE=Y CONSTRAINTS=Y STATISTICS=NONE FROMUSER=test TOUSER=test2

Import: Release 11.2.0.4.0 - Production on Wed Apr 1 09:29:49 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

Export file created by EXPORT:V11.02.00 via conventional path

Warning: the objects were exported by TEST, not by you

import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses WE8MSWIN1252 character set (possible charset conversion)
Import terminated successfully without warnings.