Wednesday, 11 April 2018

How to clone Oracle Binaries and Create a 19c Database by DBCA with Silent Mode Step by Step

 

Summary 
---------

In this blog ,We have cloned Oracle Database 11.2.0.4  (oracle software binary)  in other server and  created a 19c Database by DBCA with Silent Mode Step by Step

 

How to clone Oracle Binaries

 We are cloning  Oracle Binaries in other server.  Sometimes we install Oracle software by using a utility such as tar to copy an existing installation of the Oracle binaries to a different server.

Installing Oracle with an existing copy of the binaries is a two-part process

1) Copy the binaries on target server

2) clone binary on target server

Oracle mount point
-------------------
/oracle/product/stage/ora11204ee

ormskirk:mim11prd:/ora/easyprd $df -k|grep easyprd
/dev/easyprd901lv     2097152   2096472    1%        6     1% /ora/easyprd/901
/dev/easyprd902lv     2097152   2096472    1%        6     1% /ora/easyprd/902
/dev/easyprdtmplv     2097152   2096472    1%        6     1% /ora/easyprd/temp
/dev/easyprdarclv     3145728   3144888    1%        6     1% /ora/easyprd/arch
/dev/easyprd001lv    41418752  41412068    1%        5     1% /ora/easyprd/001
/dev/easyprdtrclv     1048576   1048056    1%        6     1% /ora/easyprd/trace
ormskirk:mim11prd:/ora/easyprd $

unset the variable
------------------

unset ORAKITPATH
unset ORACLE_SID
export ORACLE_SID
unset TNS_ADMIN
unset TD_ICU_DATA
unset ODMDItR
unset ORACLE_HOME
unset NLSPATH
unset LD_LIBRARY_PATH
unset PATH
export PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java6_64/jre/bin:/usr/java6_64/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:.:/usr/vacpp/bin:/bin:/usr/local/bin:/usr/eco/bin:.

PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java14_64/jre/bin:/usr/java5/jre/bin:/usr/java5/bin:/opt/IBM/cmdb/nmap-4.76:/usr/local/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/
X11:/sbin:.:/usr/vacpp/bin:/bin:/usr/local/bin:/usr/eco/bin

ormskirk::/oracle/product/stage/en $cat echo_var.sh
echo $MANPATH
echo $PATH
echo $COPERR
echo $COPLIB
echo $ORAKITPATH
echo $ORACLE_SID
echo $TNS_ADMIN
echo $TD_ICU_DATA
echo $ORACLE_TERM
echo $ODMDIR
echo $ORACLE_HOME
echo $NLSPATH
echo $LIBPATH
echo $LD_LIBRARY_PATH
ormskirk::/oracle/product/stage/en $cat unset_env.sh
unset MANPATH
unset PATH
unset COPERR
unset COPLIB
unset ORAKITPATH
unset ORACLE_SID
unset TNS_ADMIN
unset TD_ICU_DATA
unset ORACLE_TERM
unset ODMDIR
unset ORACLE_HOME
unset NLSPATH
unset LIBPATH
unset LD_LIBRARY_PATH
ormskirk::/oracle/product/stage/en $

Validate Oracle Database inventory if inventory is corrupt ,don't run next steps
-----------------------------------------------

ormskirk:mim11prd:/oracle/product/stage/oracle_inventory $$ORACLE_HOME/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/product/mim11prd/11.2.0.3
Central Inventory : /oracle/oraInventory
   from           : /oracle/product/mim11prd/11.2.0.3/oraInst.loc
OPatch version    : 11.2.0.3.0
OUI version       : 11.2.0.3.0
Log file location : /oracle/product/mim11prd/11.2.0.3/cfgtoollogs/opatch/opatch2014-09-18_18-23-17PM_1.log

Lsinventory Output file location : /oracle/product/mim11prd/11.2.0.3/cfgtoollogs/opatch/lsinv/lsinventory2014-09-18_18-23-17PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Database 11g                                                  11.2.0.3.0
There are 1 products installed in this Oracle Home.


Interim patches (1) :

Patch  17540582     : applied on Thu Feb 06 17:00:08 GMT 2014
Unique Patch ID:  16985513
Patch description:  "Database Patch Set Update : 11.2.0.3.9 (17540582)"
   Created on 7 Jan 2014, 04:32:31 hrs PST8PDT
Sub-patch  16902043; "Database Patch Set Update : 11.2.0.3.8 (16902043)"
Sub-patch  16619892; "Database Patch Set Update : 11.2.0.3.7 (16619892)"
Sub-patch  16056266; "Database Patch Set Update : 11.2.0.3.6 (16056266)"
Sub-patch  14727310; "Database Patch Set Update : 11.2.0.3.5 (14727310)"
Sub-patch  14275605; "Database Patch Set Update : 11.2.0.3.4 (14275605)"
Sub-patch  13923374; "Database Patch Set Update : 11.2.0.3.3 (13923374)"
Sub-patch  13696216; "Database Patch Set Update : 11.2.0.3.2 (13696216)"
Sub-patch  13343438; "Database Patch Set Update : 11.2.0.3.1 (13343438)"
   Bugs fixed:
     14469008, 14301592, 16710324, 13834065, 16703112, 13588248, 16344758
     12748538, 13742435, 9659614, 13742434, 13916549, 17333199, 12585543
     13742433, 17333197, 17333198, 13742438, 13561951, 13742437, 13742436
     12905058, 13503598, 13343438, 14523004, 13080778, 12849688, 14467061
     13103913, 13737746, 13742464, 13645917, 13036331, 12656535, 13624984
     12678920, 12401111, 17082364, 16742095, 13377816, 13910420, 12913474
     13860201, 14497307, 11063191, 13866822, 16306019, 14393728, 12391034
     13582702, 12617123, 12923168, 14791477, 16175381, 12646784, 14409183
     12583611, 14589750, 12794305, 10350832, 14480674, 14480675, 13680405
     14480676, 14095982, 13645875, 13001379, 14351566, 14189694, 12797420
     14751895, 13041324, 13385346, 14664355, 13981051, 15862018, 15862017
     15862016, 14163397, 14205448, 15862019, 15841373, 15883525, 17343514
     16619892, 12791981, 13725395, 14571027, 16844448, 13362079, 13384182
     15862020, 15862021, 15862023, 15862022, 15862024, 14053457, 9858539
     16761566, 13890080, 12780098, 16024441, 13780035, 14062797, 14052474
     14062796, 14062795, 13534412, 14062794, 14062793, 16056266, 14062792
     17230530, 17752121, 13550185, 14007968, 12880299, 13551402, 13059165
     12612118, 16721594, 9706792, 17761775, 13524899, 12621588, 13657605
     14110275, 9873405, 14727310, 13605839, 13043012, 13696216, 13493847
     16902043, 13591624, 13065099, 13685544, 14207317, 14546673, 13499128
     17088068, 14040433, 14198511, 16299830, 13440516, 14546575, 14207902
     16338983, 12662040, 9547706, 16368108, 12718090, 17748834, 17748835
     17748832, 13790109, 12959852, 17748833, 17748830, 17748831, 12780983
     12912137, 17332800, 12950644, 16372203, 13810393, 13572659, 12731940
     12772404, 9797851, 13464002, 14076523, 13358781, 13632809, 13649031
     14263073, 10400244, 16279401, 13040943, 13527323, 13492735, 13015379
     12395918, 14488943, 13843646, 13332439, 13718279, 6690853, 13616375
     11715084, 14273397, 14644185, 13559697, 13448206, 14546638, 12976376
     13070939, 11840910, 13723052, 13737888, 15987992, 13430938, 16212405
     12865902, 12744759, 10263668, 13476583, 13484963, 15910002, 13554409
     14088346, 12960925, 14038787, 12834027, 12764337, 16850197, 13772618
     14390252, 14263036, 10133521, 16844086, 13561750, 12815057, 12894807
     14841812, 16563678, 13773133, 12829021, 14841558, 17478415, 16344871
     12582664, 13632717, 13098318, 12861463, 13913630, 16362358, 16864562
     17540582, 13026410, 14188650, 16530565, 12747437, 13457582, 12873183
     17333203, 14128555, 13099577, 17333200, 17333202, 14548763, 12693626
     13907462, 13855490, 13338048, 12755116, 13489024, 13553883, 11877623
     12964067, 14369664, 13250244, 15996344, 15905421, 12847466, 13791364
     12797765, 14613900, 14755945, 13038684, 14023636, 13814739, 13035360
     14343501, 17019974, 16450169, 13420224, 12857027, 13340388, 11868640
     14121009, 12821418, 13972394, 16944698, 14512189, 13584130, 12998795
     10242202, 13467683, 12588744, 12594032, 16794238, 16794239, 13787482
     13257247, 14841409, 13366202, 13011409, 13326736, 16794243, 16794244
     16794241, 16794242, 16794240, 13466801, 9397635, 12899768, 14063281
     14063280, 13732226, 16019955, 13719081, 16038929, 8547978, 13642044
     13496884, 14220725, 13958038, 9703627, 12940620, 13923995, 13945708
     13354082, 14207163, 13579992, 16347904, 13944971, 12345082, 12784406
     13060271, 14176879, 16314469, 16314468, 16314467, 16314466, 13502183
     11071989, 15869211, 12571991, 13593999, 16294378, 13397104, 13916709
     14637368, 13848402, 9761357, 16314470, 13042639, 13936424, 16710363
     12898558, 12796518, 12535346, 12974860, 12971775, 14472647, 14398795
     16014985, 13686047, 12312133, 13807411, 16382353, 14222403, 12917230
     12983611, 13857111, 12938841, 13786142, 14127231, 11708510, 13699124
     13705338, 14762511, 12755231, 13596521, 14003090, 12658411, 14262913
     14230270, 13724193, 14695377, 16382448, 14035825, 17437634, 12919564
     13483354, 13454210, 14258925, 13544396, 13903046, 13923374, 13063120
     13370330, 16231699, 13427062, 9095696, 14275605, 14459552, 13911821
     13914613, 15853081, 13528551, 13612575, 13072654, 12620823, 14668670
     16694777, 14226599, 14138130, 13804294, 12925089, 7509451, 13369579
     14383007, 13812031, 13035804, 13092220, 14191508, 13419660, 13399435
     16462834, 10625145, 12845115, 13566938, 12748240, 12879027, 16279211, 14318397



--------------------------------------------------------------------------------

OPatch succeeded.
ormskirk:mim11prd:/oracle/product/stage/oracle_inventory $


Take backup of oracle inventory
------------------------------

tar -cvf oracle_inventory_ormskirk.tar /oracle/oraInventory

Make New Directory  For home for software installation
------------------------------------

mkdir -p /oracle/product/easyprd/11.2.0.4

Now, copy the ora11204eepsujuly2014.tar file to the db2server on which you want to install the Oracle software. tar file is copied to the  /oracle/product/easyprd/11.2.0.4 directory on db2server. The tar file is extracted there a

 

------------------

 

 

scp username@db2server:/oracle/product/stage/ora11204ee/ora11204eepsujuly2014.tar .

Make sure you have 8 GB of free space. Next, extract the files:

 

cd /oracle/product/easyprd/11.2.0.4
tar -xvf /oracle/product/stage/ora11204ee/ora11204eepsujuly2014.tar

----------
After untar run below command for clone
----------------------------------------------

cd /oracle/product/easyprd/11.2.0.4/clone/bin


perl clone.pl ORACLE_HOME="<target_home>" ORACLE_HOME_NAME="<unique_home_name>" ORACLE_BASE="<path_for_ORACLE_BASE>" OSDBA_GROUP=<OSDBA_privileged_group> OSOPER_GROUP=<OSOPER_privileged_group>

eg


perl clone.pl ORACLE_HOME="/oracle/product/easyprd/11.2.0.4" ORACLE_HOME_NAME="ORAEASYPRD11204" ORACLE_BASE="/oracle" OSDBA_GROUP=dba OSOPER_GROUP=dba

ormskirk::/oracle/product/easyprd/11.2.0.4/clone/bin $
ormskirk::/oracle/product/easyprd/11.2.0.4/clone/bin $E_NAME="ORAEASYPRD11204" ORACLE_BASE="/oracle" OSDBA_GROUP=dba OSOPER_GROUP=dba                                                             <
********************************************************************************

Your platform requires the root user to perform certain pre-clone
OS preparation.  The root user should run the shell script 'rootpre.sh' before
you proceed with cloning.  rootpre.sh can be found at
/oracle/product/easyprd/11.2.0.4/clone directory.
Answer 'y' if the root user has run 'rootpre.sh' script.

********************************************************************************

Has 'rootpre.sh' been run by the root user? [y/n] (n)
y
./runInstaller -clone -waitForCompletion  "ORACLE_HOME=/oracle/product/easyprd/11.2.0.4" "ORACLE_HOME_NAME=ORAEASYPRD11204" "ORACLE_BASE=/oracle" "oracle_install_OSDBA=dba" "oracle_install_OSOPER=dba" -silent -noConfig -nowait
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 20480 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-09-18_07-29-20PM. Please wait ...Oracle Universal Installer, Version 11.2.0.4.0 Production
Copyright (C) 1999, 2013, Oracle. All rights reserved.

You can find the log of this install session at:
 /oracle/oraInventory/logs/cloneActions2014-09-18_07-29-20PM.log
.................................................................................................... 100% Done.

Installation in progress (Thursday, September 18, 2014 7:29:35 PM BST)
..............................................................................                                                  78% Done.
Install successful

Linking in progress (Thursday, September 18, 2014 7:29:44 PM BST)
Link successful

Setup in progress (Thursday, September 18, 2014 7:31:18 PM BST)
Setup successful

End of install phases.(Thursday, September 18, 2014 7:31:50 PM BST)
WARNING:
The following configuration scripts need to be executed as the "root" user.
/oracle/product/easyprd/11.2.0.4/root.sh
To execute the configuration scripts:
    1. Open a terminal window
    2. Log in as "root"
    3. Run the scripts

The cloning of ORAEASYPRD11204 was successful.
Please check '/oracle/oraInventory/logs/cloneActions2014-09-18_07-29-20PM.log' for more details.
ormskirk::/oracle/product/easyprd/11.2.0.4/clone/bin $

run scripts  as the "root" user.

/oracle/product/easyprd/11.2.0.4/root.sh

Now software installation completed successfully


check listner status

 

lsnrctl status

===============End of Software Installation============

How to Create a 19c Database by DBCA with Silent Mode

exadev.rsp-- This is the database creation response file and make necessary correction as per requirement.
scp username@lanner:/oracle/product/stage/exadev.rsp .

 

Enviroment Details

 

Database related File system


ormskirk:mim11prd:/ora/easyprd $df -k|grep easyprd
/dev/easyprd901lv     2097152   2096472    1%        6     1% /ora/easyprd/901
/dev/easyprd902lv     2097152   2096472    1%        6     1% /ora/easyprd/902
/dev/easyprdtmplv     2097152   2096472    1%        6     1% /ora/easyprd/temp
/dev/easyprdarclv     3145728   3144888    1%        6     1% /ora/easyprd/arch
/dev/easyprd001lv    41418752  41412068    1%        5     1% /ora/easyprd/001
/dev/easyprdtrclv     1048576   1048056    1%        6     1% /ora/easyprd/trace
ormskirk:mim11prd:/ora/easyprd $

 

 

Step to create new database

1) set the new environment as per new database as below

export ORACLE_HOME=/oracle/product/easyprd/11.2.0.4
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java14_64/jre/bin:/usr/java5/jre/bin:/usr/java5/bin:/opt/IBM/cmdb/nmap-4.76:/usr/local/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:.:/usr/vacpp/bin:/bin:/usr/local/bin:/usr/eco/bin:/oracle/product/easyprd/11.2.0.4/bin:/oracle/local/bin

echo $ORACLE_HOME
echo $LD_LIBRARY_PATH
echo $PATH

2) create Oracle Database Configuration Assistant response file:

 

  a)  Copy the dbca. rsp response file template from the response file directory to a directory on your system.

 b) The Open the dbca. rsp response file in a text editor.

 c)  Edit the dbca. rsp file


cp /oracle/product/stage/ora11204ee/easyprd.rsp /oracle/product/easyprd/11.2.0.4/assistants/dbca/

3) create a 19c database with silent mode.

$ORACLE_HOME/bin/dbca -silent -responseFile /oracle/product/easyprd/11.2.0.4/assistants/dbca/easyprd.rsp

#-----------------------*** End of DELETEINSTANCE section ***------------------------
ormskirk::/oracle/product/easyprd/11.2.0.4/assistants/dbca $echo $ORACLE_HOME
/oracle/product/easyprd/11.2.0.4
ormskirk::/oracle/product/easyprd/11.2.0.4/assistants/dbca $$ORACLE_HOME/bin/dbca -silent -responseFile /oracle/product/easyprd/11.2.0.4/assistants/dbca/easyprd.rsp
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
57% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/oracle/cfgtoollogs/dbca/easyprd/easyprd.log" for further details.
ormskirk::/oracle/product/easyprd/11.2.0.4/assistants/dbca $

After creation of Database ,As part of post verification . perform below task

 

1) Login on database and check database 

 

 SQL> select name,open_mode from v$database;

SQL> select comp_id,status from dba_registry;

 

2) Login on database and set right for diagnostic file

 

ormskirk::/oracle/product/easyprd/11.2.0.4/assistants/dbca $. oraenv
ORACLE_SID = [oracle] ? easyprd
The Oracle base remains unchanged with value /oracle
ormskirk:easyprd:/oracle/product/easyprd/11.2.0.4/assistants/dbca $sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.4.0 Production on Thu Sep 18 20:10:22 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL>
SQL> show parameter diag

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
diagnostic_dest                      string      /oracle

SQL>
SQL> alter system set diagnostic_dest='/ora/easyprd/trace/oradata/easyprd' scope=both;

System altered.

3) Verify datafile ,control file and redo log file

SQL> SELECT member FROM v$logfile
UNION ALL
SELECT name FROM v$datafile
UNION ALL
SELECT name FROM v$controlfile
union all
select file_name from dba_temp_files;  2    3    4    5    6    7

MEMBER
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/ora/easyprd/001/oradata/easyprd/redo03.log
/ora/easyprd/001/oradata/easyprd/redo02.log
/ora/easyprd/001/oradata/easyprd/redo01.log
/ora/easyprd/001/oradata/easyprd/system01.dbf
/ora/easyprd/001/oradata/easyprd/sysaux01.dbf
/ora/easyprd/001/oradata/easyprd/undotbs01.dbf
/ora/easyprd/001/oradata/easyprd/users01.dbf
/ora/easyprd/001/oradata/easyprd/example01.dbf
/ora/easyprd/001/oradata/easyprd/control01.ctl
/oracle/fast_recovery_area/easyprd/control02.ctl
/ora/easyprd/001/oradata/easyprd/temp01.dbf

11 rows selected.

ls -ltr /ora/easyprd/001/oradata/easyprd/control01.ctl
mv /oracle/fast_recovery_area/easyprd/control02.ctl /ora/easyprd/901/oradata/easyprd/control02.ctl
cp /ora/easyprd/001/oradata/easyprd/control01.ctl /ora/easyprd/902/oradata/easyprd/control03.ctl

ls -ltr /ora/easyprd/001/oradata/easyprd/control01.ctl
ls -ltr /ora/easyprd/901/oradata/easyprd/control02.ctl
ls -ltr /ora/easyprd/902/oradata/easyprd/control03.ctl


as per project requirement ,control files are not created at right  system file  and place on right location  as below

cp /ora/exadev/001/oradata/exadev/exadev/control01.ctl /ora/exadev/901/oradata/exadev/control01.ctl

mv /oracle/fast_recovery_area/exadev/control02.ctl /ora/exadev/902/oradata/exadev/

alter system set control_files='/ora/easyprd/001/oradata/easyprd/control01.ctl','/ora/easyprd/901/oradata/easyprd/control02.ctl','/ora/easyprd/902/oradata/easyprd/control03.ctl' scope=spfile;
alter system set control_files='/ora/easyprd/001/oradata/easyprd/control01.ctl','/ora/easyprd/901/oradata/easyprd/control02.ctl','/ora/easyprd/902/oradata/easyprd/control03.ctl' scope=both;


as per project requirement ,redo log file is not created at right system file and place on right location  as below

SQL> column member format a55
SQL> select group#, member from v$logfile
  2  ;

    GROUP# MEMBER
---------- -------------------------------------------------------
         3 /ora/easyprd/001/oradata/easyprd/redo03.log
         2 /ora/easyprd/001/oradata/easyprd/redo02.log
         1 /ora/easyprd/001/oradata/easyprd/redo01.log

SQL>


ALTER DATABASE ADD LOGFILE MEMBER '/ora/easyprd/902/oradata/easyprd/redo033.log' TO GROUP 3;
ALTER DATABASE ADD LOGFILE MEMBER '/ora/easyprd/902/oradata/easyprd/redo022.log' TO GROUP 2;
ALTER DATABASE ADD LOGFILE MEMBER '/ora/easyprd/902/oradata/easyprd/redo011.log' TO GROUP 1;


mv /ora/easyprd/001/oradata/easyprd/redo03.log /ora/easyprd/901/oradata/easyprd/redo03.log
mv /ora/easyprd/001/oradata/easyprd/redo02.log /ora/easyprd/901/oradata/easyprd/redo02.log
mv /ora/easyprd/001/oradata/easyprd/redo01.log /ora/easyprd/901/oradata/easyprd/redo01.log


ls -ltr /ora/easyprd/901/oradata/easyprd/redo03.log
ls -ltr /ora/easyprd/901/oradata/easyprd/redo02.log
ls -ltr /ora/easyprd/901/oradata/easyprd/redo01.log



ALTER DATABASE RENAME FILE
'/ora/easyprd/001/oradata/easyprd/redo01.log','/ora/easyprd/001/oradata/easyprd/redo02.log','/ora/easyprd/001/oradata/easyprd/redo03.log'
to '/ora/easyprd/901/oradata/easyprd/redo01.log','/ora/easyprd/901/oradata/easyprd/redo02.log', '/ora/easyprd/901/oradata/easyprd/redo03.log';


Mount Database and rename log file


Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area 2355015680 bytes
Fixed Size                  2248600 bytes
Variable Size             620757096 bytes
Database Buffers         1610612736 bytes
Redo Buffers              121397248 bytes
Database mounted.
SQL>
ALTER DATABASE RENAME FILE
'/ora/easyprd/001/oradata/easyprd/redo01.log','/ora/easyprd/001/oradata/easyprd/redo02.log','/ora/easyprd/001/oradata/easyprd/redo03.log'
to '/ora/easyprd/901/oradata/easyprd/redo01.log','/ora/easyprd/901/oradata/easyprd/redo02.log', '/ora/easyprd/901/oradata/easyprd/redo03.log';

SQL>   2    3
Database altered.

SQL> SQL>
SQL> column member format a55
SQL> select group#, member from v$logfile
  2  ;

    GROUP# MEMBER
---------- -------------------------------------------------------
         3 /ora/easyprd/901/oradata/easyprd/redo03.log
         2 /ora/easyprd/901/oradata/easyprd/redo02.log
         1 /ora/easyprd/901/oradata/easyprd/redo01.log
         1 /ora/easyprd/902/oradata/easyprd/redo011.log
         2 /ora/easyprd/902/oradata/easyprd/redo022.log
         3 /ora/easyprd/902/oradata/easyprd/redo033.log

6 rows selected.

SQL>


SQL> alter database open;

Database altered.

SQL>

Set archive log location as per project requirement

ALTER SYSTEM SET LOG_ARCHIVE_DEST_1 = 'LOCATION=/ora/easyprd/arch/oradata/easyprd' scope=both


SQL> !ls -ltr /ora/easyprd/arch/oradata/easyprd
total 0

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1 = 'LOCATION=/ora/easyprd/arch/oradata/easyprd' scope=both;

System altered.

SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 2355015680 bytes
Fixed Size                  2248600 bytes
Variable Size             620757096 bytes
Database Buffers         1610612736 bytes
Redo Buffers              121397248 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL>

as per project requirement ,temp files are not created at right file system  and place on right location  as below


A) Alter database tempfile '/u02/oracle/temp01.dbf' offline;
B)  Copy file from old location to new location using OS commands.
cp /u02/oracle/temp01.dbf /u02/oracle/temp/temp01.dbf
C) Rename file
Alter database rename file '/u02/oracle/temp01.dbf' to '/u02/oracle/temp/temp01.dbf';
D. Bring it online

Alter database tempfile '/u02/oracle/temp/temp01.dbf' online;

Alter database tempfile '/ora/easyprd/001/oradata/easyprd/temp01.dbf' offline;

mv /ora/easyprd/001/oradata/easyprd/temp01.dbf /ora/easyprd/temp/oradata/easyprd/temp01.dbf


Alter database rename file '/ora/easyprd/001/oradata/easyprd/temp01.dbf' to '/ora/easyprd/temp/oradata/easyprd/temp01.dbf';

Alter database tempfile '/ora/easyprd/temp/oradata/easyprd/temp01.dbf' online;


Finally verify all log file ,data file ,control file and temp file

SELECT member FROM v$logfile
UNION ALL
SELECT name FROM v$datafile
UNION ALL
SELECT name FROM v$controlfile
union all
select file_name from dba_temp_files;




=============General==================

 



ORACLE_HOME = /oracle/ecomprod/product/10.2.0.4

scp -r templates.tar shahique@10.160.37.11:/oracle/product/reports

alter database backup controlfile to trace as '/path/filename.trc';

prtconf | grep -i mem

psrinfo -v|grep "Status of virtual processor"|wc -l



cd /oracle/ecomprod/product/10.2.0.4
tar -cvf /oracle/product/stage/ora11204ee/ora11204eepsujuly2014.tar .

mkdir ora11204ee

mkdir -p /oracle/product/exappt/11.2.0.4

scp   ora11204eepsujuly2014.tar eibm994@lanner:/oracle/product/stage

scp /oracle/product/exappt/11.2.0.4/assistants/dbca/exappt.rsp eibm994@lanner:/oracle/product/stage/

scp ora11204eepsujuly2014.tar eibm994@ormskirk:/oracle/product/stage/

scp eibm994@lanner:/oracle/product/stage/ora11204ee/ora11204eepsujuly2014.tar .


Enviroment
---------------------

Database related file system

SQL> !df -k |grep exappt
/dev/fslv14      30408704  28434944    7%       18     1% /ora/exappt/001 -datafile
/dev/fslv15       2097152   2086048    1%        6     1% /ora/exappt/902 -controlfile and redolog file
/dev/fslv16       2097152   2086048    1%        6     1% /ora/exappt/901- -controlfile and redolog file
/dev/fslv17       2097152   2088280    1%        6     1% /ora/exappt/temp
/dev/fslv18       3145728   3132600    1%        6     1% /ora/exappt/arch
/dev/fslv19       1048576   1039864    1%        6     1% /ora/exappt/trace

Collect details for Datafile ,logfile and controlfile

SELECT member FROM v$logfile
UNION ALL
SELECT name FROM v$datafile
UNION ALL
SELECT name FROM v$controlfile
union all
select file_name from dba_temp_files;

/ora/exappt/001/oradata/exappt/redo03.log
/ora/exappt/001/oradata/exappt/redo02.log
/ora/exappt/001/oradata/exappt/redo01.log
/ora/exappt/001/oradata/exappt/system01.dbf
/ora/exappt/001/oradata/exappt/sysaux01.dbf
/ora/exappt/001/oradata/exappt/undotbs01.dbf
/ora/exappt/001/oradata/exappt/users01.dbf
/ora/exappt/001/oradata/exappt/example01.dbf
/ora/exappt/001/oradata/exappt/control01.ctl
/oracle/fast_recovery_area/exappt/control02.ctl
/ora/exappt/001/oradata/exappt/temp01.dbf


To check spfile and control file

SQL> show parameter spfil

SQL> show parameter control

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      /ora/exappt/001/oradata/exappt
                                                 /control01.ctl, /oracle/fast_r
                                                 ecovery_area/exappt/control02.
                                                 ctl
control_management_pack_access       string      DIAGNOSTIC+TUNING
SQL> sho parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /oracle/product/exappt/11.2.0.
                                                 4/dbs/spfileexappt.ora
SQL>
SQL>

To Move control file on new location

 

1)  shutdown database

2) move control file on new location

 

mv /ora/exappt/001/oradata/exappt/control01.ctl /ora/exappt/901/oradata/exappt/
mv /oracle/fast_recovery_area/exappt/control02.ctl /ora/exappt/902/oradata/exappt/

startup nomount

alter system set control_files='/ora/exappt/901/oradata/exappt/control01.ctl','/ora/exappt/902/oradata/exappt/control02.ctl' scope=spfile;
shutdown immediate
startup

Verify Datafile ,logfile and controlfile

SELECT member FROM v$logfile
UNION ALL
SELECT name FROM v$datafile
UNION ALL
SELECT name FROM v$controlfile
union all
select file_name from dba_temp_files;

To Move redo log file on new location

 

----------------------
1) check redo log location

SQL> column member format a55
select group#, member from v$logfileSQL>
  2  ;

    GROUP# MEMBER
---------- ---------------------------------------------
         3 /ora/exappt/001/oradata/exappt/exappt/redo03.
           log

         2 /ora/exappt/001/oradata/exappt/exappt/redo02.
           log

         1 /ora/exappt/001/oradata/exappt/exappt/redo01.
           log


2) shutdown database
shut immediate

3) move redo log file to target location


mv /ora/exappt/001/oradata/exappt/redo03.log /ora/exappt/901/oradata/exappt/
mv /ora/exappt/001/oradata/exappt/redo02.log /ora/exappt/901/oradata/exappt/
mv /ora/exappt/001/oradata/exappt/redo01.log /ora/exappt/901/oradata/exappt/

ls -ltr /ora/exappt/901/oradata/exappt/

4) start database in mount stage


startup mount

5) rename redo log file


ALTER DATABASE RENAME FILE
'/ora/exappt/001/oradata/exappt/redo03.log','/ora/exappt/001/oradata/exappt/redo02.log','/ora/exappt/001/oradata/exappt/redo01.log'
to '/ora/exappt/901/oradata/exappt/redo03.log','/ora/exappt/901/oradata/exappt/redo02.log', '/ora/exappt/901/oradata/exappt/redo01.log';


To Add redo log file

-------------------


ALTER DATABASE ADD LOGFILE MEMBER '/ora/exappt/902/oradata/exappt/redo011.log' TO GROUP 1;
ALTER DATABASE ADD LOGFILE MEMBER '/ora/exappt/902/oradata/exappt/redo022.log' TO GROUP 2;
ALTER DATABASE ADD LOGFILE MEMBER '/ora/exappt/902/oradata/exappt/redo033.log' TO GROUP 3;


SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC
---------- ---------- ---------- ---------- ---------- ---------- ---
STATUS           FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------------- ------------- --------- ------------ ---------
         1          1          7   52428800        512          1 NO
CURRENT                 991094 15-AUG-14   2.8147E+14

         2          1          5   52428800        512          1 NO
INACTIVE                960576 15-AUG-14       979517 15-AUG-14

         3          1          6   52428800        512          1 NO
INACTIVE                979517 15-AUG-14       991094 15-AUG-14


SQL>

Verify


alter system switch logfile;
select * from v$log;
SQL> select group#,bytes/1024/1024  from v$log;

    GROUP# BYTES/1024/1024
---------- ---------------
         1              50
         2              50
         3              50


========================


===================

SQL> show parameter dump

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
background_core_dump                 string      partial
background_dump_dest                 string      /oracle/diag/rdbms/exappt/exad
                                                 ev/trace
core_dump_dest                       string      /oracle/diag/rdbms/exappt/exad
                                                 ev/cdump
max_dump_file_size                   string      unlimited
shadow_core_dump                     string      partial
user_dump_dest                       string      /oracle/diag/rdbms/exappt/exad
                                                 ev/trace
SQL>

SQL> show parameter diag

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
diagnostic_dest                      string      /oracle
SQL>

ALTER SYSTEM set diagnostic_dest='/ora/exappt/trace/oradata/exappt'; 

SQL> show parameter diag

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
diagnostic_dest                      string      /oracle
SQL> ALTER SYSTEM set diagnostic_dest='/ora/exappt/trace/oradata/exappt' scope=both
  2  ;

System altered.

SQL> show parameter diag

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
diagnostic_dest                      string      /ora/exappt/trace/oradata/exad
                                                 ev
SQL>

======================

column property_value format a20
select property_name,property_value from database_properties where property_name='DEFAULT_TEMP_TABLESPACE';

========================

SQL> select file_name from dba_temp_files
  2  ;

FILE_NAME
--------------------------------------------------------------------------------
/ora/exappt/001/oradata/exappt/temp01.dbf

SQL>


Alter database tempfile '/u02/oracle/temp01.dbf' offline;
5. Copy file from old location to new location using OS commands.
cp /u02/oracle/temp01.dbf /u02/oracle/temp/temp01.dbf
6. Rename file
Alter database rename file '/u02/oracle/temp01.dbf' to '/u02/oracle/temp/temp01.dbf';
7. Bring it online
Alter database tempfile '/u02/oracle/temp/temp01.dbf' online;

------------------------
Alter database tempfile '/ora/exappt/001/oradata/exappt/temp01.dbf' offline;


mv /ora/exappt/001/oradata/exappt/temp01.dbf /ora/exappt/temp/oradata/exappt/


Alter database rename file '/ora/exappt/001/oradata/exappt/temp01.dbf' to '/ora/exappt/temp/oradata/exappt/temp01.dbf';

Alter database tempfile '/ora/exappt/temp/oradata/exappt/temp01.dbf' online;

SELECT member FROM v$logfile
UNION ALL
SELECT name FROM v$datafile
UNION ALL
SELECT name FROM v$controlfile
union all
select file_name from dba_temp_files;
archive log list;

select r.file# as df#,d.name as df_name,t.name as tbs_name,d.status,r.error,r.change#,r.time
from v$recover_file r,v$datafile d,v$tablespace t
where t.ts#=d.ts#
and d.file#=r.file#


select d.name as df_name,t.name as tbs_name,d.status
from v$datafile d,v$tablespace t
where t.ts#=d.ts#;

ALTER SYSTEM SET LOG_ARCHIVE_DEST_1 = 'LOCATION=/ora/exappt/arch/oradata/exappt' scope=both



lanner:exappt:/oracle/product/exappt/11.2.0.4/dbs $ls -ltr
total 40
-rw-r--r--    1 oracle   dba            2851 May 15 2009  init.ora
-rw-r-----    1 oracle   dba              24 Aug 15 15:41 lkEXAPPT
-rw-r-----    1 oracle   dba            1536 Aug 15 15:44 orapwexappt
-rw-r-----    1 oracle   dba            2560 Aug 15 16:14 spfileexappt.ora
-rw-rw----    1 oracle   dba            1544 Aug 15 16:24 hc_exappt.dat
lanner:exappt:/oracle/product/exappt/11.2.0.4/dbs $

mv /oracle/product/exappt/11.2.0.4/dbs/spfileexappt.ora .
mv /oracle/product/exappt/11.2.0.4/dbs/orapwexappt .


ln -s /oracle/admin/exappt/pfile/spfileexappt.ora /oracle/product/exappt/11.2.0.4/dbs/spfileexappt.ora
ln -s  /oracle/admin/exappt/pfile/orapwexappt /oracle/product/exappt/11.2.0.4/dbs/orapwexappt








--------------------------------------------------------------------------------
/ora/exappt/901/oradata/exappt/redo03.log
/ora/exappt/901/oradata/exappt/redo02.log
/ora/exappt/901/oradata/exappt/redo01.log
/ora/exappt/902/oradata/exappt/redo011.log
/ora/exappt/902/oradata/exappt/redo022.log
/ora/exappt/902/oradata/exappt/redo033.log
/ora/exappt/001/oradata/exappt/exappt/system01.dbf
/ora/exappt/001/oradata/exappt/exappt/sysaux01.dbf
/ora/exappt/001/oradata/exappt/exappt/undotbs01.dbf
/ora/exappt/001/oradata/exappt/exappt/users01.dbf
/ora/exappt/001/oradata/exappt/exappt/example01.dbf

MEMBER
--------------------------------------------------------------------------------
/ora/exappt/901/oradata/exappt/control01.ctl
/ora/exappt/902/oradata/exappt/control02.ctl
/ora/exappt/temp/oradata/exappt/temp01.dbf


mv /ora/exappt/001/oradata/exappt/exappt/system01.dbf /ora/exappt/001/oradata/exappt/system01.dbf
mv /ora/exappt/001/oradata/exappt/exappt/sysaux01.dbf /ora/exappt/001/oradata/exappt/sysaux01.dbf
mv /ora/exappt/001/oradata/exappt/exappt/undotbs01.dbf /ora/exappt/001/oradata/exappt/undotbs01.dbf
mv /ora/exappt/001/oradata/exappt/exappt/users01.dbf /ora/exappt/001/oradata/exappt/users01.dbf
mv /ora/exappt/001/oradata/exappt/exappt/example01.dbf /ora/exappt/001/oradata/exappt/example01.dbf

startup mount


Alter database rename file '/ora/exappt/001/oradata/exappt/exappt/system01.dbf' to '/ora/exappt/001/oradata/exappt/system01.dbf';
Alter database rename file '/ora/exappt/001/oradata/exappt/exappt/sysaux01.dbf' to '/ora/exappt/001/oradata/exappt/sysaux01.dbf';
Alter database rename file '/ora/exappt/001/oradata/exappt/exappt/undotbs01.dbf' to '/ora/exappt/001/oradata/exappt/undotbs01.dbf';
Alter database rename file '/ora/exappt/001/oradata/exappt/exappt/users01.dbf' to '/ora/exappt/001/oradata/exappt/users01.dbf';
Alter database rename file '/ora/exappt/001/oradata/exappt/exappt/example01.dbf' to '/ora/exappt/001/oradata/exappt/example01.dbf';



ORACLE_HOME = /oracle/ecomprod/product/10.2.0.4

scp -r templates.tar shahique@10.160.37.11:/oracle/product/reports

alter database backup controlfile to trace as '/path/filename.trc';

prtconf | grep -i mem

psrinfo -v|grep "Status of virtual processor"|wc -l


tar -cvf /oracle/product/stage/ora11204ee/ora11204eepsujuly2014.tar .

mkdir ora11204ee

mkdir -p /oracle/product/exappt/11.2.0.4

scp   ora11204eepsujuly2014.tar eibm994@lanner:/oracle/product/stage

scp /oracle/product/exappt/11.2.0.4/assistants/dbca/exappt.rsp eibm994@lanner:/oracle/product/stage/


------------------------------------------------------------------------------

-

 

No comments:

Post a Comment