Wednesday, February 12, 2020

Clone using RMAN backup - Target on different server ( Source PROD11 , Target TEST ) - Oracle 11g

Clone using RMAN backup - Target on different server ( Source PROD11 , Target TEST ) - Oracle 11g

******************* Start ******************

**** SOURCE

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
/u04/app/oracle/oradata/prod11/prod11/users01.dbf
/u04/app/oracle/oradata/prod11/prod11/undotbs01.dbf
/u04/app/oracle/oradata/prod11/prod11/sysaux01.dbf
/u04/app/oracle/oradata/prod11/prod11/system01.dbf

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u04/app/oracle/oradata/prod11/prod11/redo03.log
/u04/app/oracle/oradata/prod11/prod11/redo02.log
/u04/app/oracle/oradata/prod11/prod11/redo01.log

SQL> select NAME,db_unique_name from v$database;

NAME      DB_UNIQUE_NAME
--------- ------------------------------
PROD11    prod11

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
prod11


**** TAKE RMAN FULL BACKUP

rman target /
connected to target database: PROD11 (DBID=4142957128)

RMAN> sql "alter session set nls_date_format=''dd.mm.yyyy hh24:mi:ss''";
RUN
{
configure controlfile autobackup on;
set command id to 'DBPROD11FULL';
ALLOCATE CHANNEL c1 DEVICE TYPE disk;
ALLOCATE CHANNEL c2 DEVICE TYPE disk;

backup AS COMPRESSED BACKUPSET full database
tag PROD_FULL
format '/u01/backup/%d_%T_%s_%p_FULL' ;

backup archivelog all
tag PROD_FULL
format '/u01/backup/%d_%T_%s_%p_ARCHIVE' ;

backup current controlfile
tag PROD_FULL
format '/u01/backup/%d_%T_%s_%p_CONTROL';

release channel c1;
release channel c2;
}

**** COPY THE BACKUP PIECES on TEST SERVER

[oracle@prod backup]$ ls -ltr
total 324396
-rw-r----- 1 oracle oinstall  74383360 Feb 07 20:58 PROD11_20200212_2_1_FULL
-rw-r----- 1 oracle oinstall 185679872 Feb 07 20:58 PROD11_20200212_1_1_FULL
-rw-r----- 1 oracle oinstall  38057984 Feb 07 20:58 PROD11_20200212_4_1_ARCHIVE
-rw-r----- 1 oracle oinstall  23897088 Feb 07 20:58 PROD11_20200212_3_1_ARCHIVE
-rw-r----- 1 oracle oinstall   9797632 Feb 07 20:58 PROD11_20200212_5_1_CONTROL

[oracle@prod backup]$ scp PROD* oracle@stand.som.com:/u01/backup/



**** ON TARGET NOW ..........

**** ENV FILE

[oracle@stand ~]$ cat test.env
export ORACLE_SID=test
export ORACLE_HOME=/u04/app/oracle/11g
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=$ORACLE_HOME/bin:/opt/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH


**** DBS file ( init and password files ) and then NOMOUNT TEST DATABASE

[oracle@stand dbs]$ cat inittest.ora
test.__db_cache_size=251658240
test.__java_pool_size=4194304
test.__large_pool_size=4194304
test.__oracle_base='/u04/app/oracle'#ORACLE_BASE set from environment
test.__pga_aggregate_target=130023424
test.__sga_target=381681664
test.__shared_io_pool_size=0
test.__shared_pool_size=113246208
test.__streams_pool_size=0
*.audit_file_dest='/u04/app/oracle/admin/test/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u04/app/oracle/oradata/test/control01.ctl','/u04/app/oracle/oradata/test/control02.ctl'
*.db_file_name_convert='/u04/app/oracle/oradata/prod11/prod11','/u04/app/oracle/oradata/test'
*.log_file_name_convert='/u04/app/oracle/oradata/prod11/prod11','/u04/app/oracle/oradata/test'
*.db_block_size=8192
*.db_domain=''
*.db_name='test'
*.diagnostic_dest='/u04/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'
##*.local_listener='LISTENER_TEST'
*.log_archive_dest_1='LOCATION=/u04/app/oracle/oraarch'
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.pga_aggregate_target=126877696
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=380633088
*.undo_tablespace='UNDOTBS1'

[oracle@stand dbs]$ ls -ltr orapwtes*
-rw-r----- 1 oracle oinstall 1536 Feb 07 21:04 orapwtest


SQL> startup nomount pfile='inittest.ora'
ORACLE instance started.

Total System Global Area  379965440 bytes
Fixed Size                  2213576 bytes
Variable Size             121637176 bytes
Database Buffers          251658240 bytes
Redo Buffers                4456448 bytes
SQL> exit



**** RMAN SCRIPT:
=========================================

[oracle@stand dbs]$ rman

RMAN> connect auxiliary /

connected to auxiliary database: TEST (not mounted)

RMAN> run
{
ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
DUPLICATE DATABASE TO "TEST" BACKUP LOCATION '/u01/backup/';
}2> 3> 4> 5> 6>

...
.....
......

database opened
Finished Duplicate Db at 07-FEB-19
released channel: aux1
released channel: aux2

RMAN>

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


**** VALIDATION :


[oracle@stand dbs]$ ps -ef|grep pmon
oracle    16879      1  0 21:35 ?        00:00:00 ora_pmon_test


SQL> select NAME,db_unique_name from v$database;

NAME      DB_UNIQUE_NAME
--------- ------------------------------
TEST

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
/u04/app/oracle/oradata/test/system01.dbf
/u04/app/oracle/oradata/test/sysaux01.dbf
/u04/app/oracle/oradata/test/undotbs01.dbf
/u04/app/oracle/oradata/test/users01.dbf

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u04/app/oracle/oradata/test/redo03.log
/u04/app/oracle/oradata/test/redo02.log
/u04/app/oracle/oradata/test/redo01.log

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
test

******************* END ******************

Thanks,



Monday, February 10, 2020

Linux - Script to check archives on production every 15 mins and copy it on test server

Linux - Script to check archives on production every 15 mins and copy it on test server


*/5 * * * * sh /home/scripts/cp_arch.sh   #### Script will run every 5 mins from crontab

Main script:
=================================================

#!/bin/bash
#cp_arch.sh
#Script to copy archive logs to Test Server

find /u01/archive -mmin -720 > /home/oracle/scripts/find_arch.txt 

### Above will check all the archives generated in last 12 hrs , we can reduce as per environment. #####


tail -n+2 /home/oracle/scripts/find_arch.txt > /home/oracle/scripts/final_lst

while IFS= read -r line; do
    echo "scp $line oracle@test.example.com:/u01/arch_backup_prod/"
done < /home/oracle/scripts/final_lst > /home/oracle/scripts/last_12hr.sh

sh /home/oracle/scripts/last_12hr.sh

###### End of Script

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





Thanks

Saturday, February 8, 2020

VM Manager and VM server services shutdown/startup



VM Manager services startup/shutdown:
=====================================

[root@prodserver ~]# /sbin/service ovmm stop
Stopping Oracle VM Manager                                 [  OK  ]

[root@prodserver ~]# /sbin/service ovmm status
Oracle VM Manager is not running...

[root@prodserver ~]# /sbin/service ovmm start
Starting Oracle VM Manager                                 [  OK  ]

[root@prodserver ~]# /sbin/service ovmm status
Oracle VM Manager is running...

VM manager url should work now.



VM server services startup/shutdown:
====================================


[root@ovmserver ~]# service ovs-agent stop
Stopping Oracle VM Agent:                                  [  OK  ]

[root@ovmserver ~]# service ovs-agent start
Starting Oracle VM Agent:                                  [  OK  ]

[root@ovmserver ~]# nc -nv 192.168.1.176 7002
Connection to 192.168.1.176 7002 port [tcp/*] succeeded!
^C

[root@ovmserver ~]# service ovs-agent status
log server (pid 10192) is running...
notificationserver server (pid 10373) is running...
remaster server (pid 10379) is running...
monitor server (pid 10381) is running...
ha server (pid 10383) is running...
stats server (pid 10386) is running...
xmlrpc server (pid 10391) is running...
fsstats server (pid 10390) is running...
apparentsize server (pid 10392) is running...


Thanks,

OVM mysql database corrupted - Recreated DB and repopulate the data

Below steps we have performed to recreate the mysql database.

Issue - VM was unavailable.

[root@prodvm dbbackup]# cat /u01/app/oracle/ovm-manager-3/.config
DBTYPE=MySQL
DBHOST=localhost
SID=ovs
LSNR=49500
OVSSCHEMA=ovs
APEX=8080
WLSADMIN=weblogic
OVSADMIN=admin
COREPORT=54321
UUID=0004fb000001000096b6a4ca0c480d52
BUILDID=3.4.4.1709



[root@prodvm bin]# sh /u01/app/oracle/ovm-manager-3/ovm_upgrade/bin/ovm_upgrade.sh --deletedb --dbuser=ovs --dbpass=******* --dbhost=localhost --dbport=49500 --dbsid=ovs

COMMAND: /u01/app/oracle/ovm-manager-3/ovm_upgrade/bin/ovm_upgrade.sh --deletedb --dbuser=ovs --dbpass=******* --dbhost=localhost --dbport=49500 --dbsid=ovs

Copying deleted classes files to patch path location
2018-01-31 21:15:58,532  INFO Oracle OVM Manager Upgrade Processor
2018-01-31 21:15:58,532  INFO
Jan 31, 2018 9:15:58 PM oracle.security.jps.JpsStartup start
INFO: Jps initializing.
Jan 31, 2018 9:16:00 PM oracle.security.jps.JpsStartup start
INFO: Jps started.
2018-01-31 21:16:00,069  INFO Upgrade Initialization Starting
2018-01-31 21:16:00,142  INFO Oracle Distributed Object Fabric (ODOF): Copyright (C) 2007, 2016 Oracle.  All rights reserved.
2018-01-31 21:16:00,142  INFO ODOF Version: 1.3.1.4
2018-01-31 21:16:00,142  INFO Initializing...
2018-01-31 21:16:00,738  INFO Initialization Complete
2018-01-31 21:16:00,740  INFO Upgrade Initialization Complete
2018-01-31 21:16:00,740  INFO Database Wipe Starting
2018-01-31 21:16:00,740  INFO Wiping Exchange
2018-01-31 21:16:00,797  INFO Initializing / Clearing Database Tables
2018-01-31 21:16:24,023  INFO Wiping Complete!
2018-01-31 21:16:24,024  INFO Database Wipe Complete


[root@prodvm bin]# service ovmm start
Starting Oracle VM Manager                                 [  OK  ]

[root@prodvm bin]# service ovmm status
Oracle VM Manager is running...

[root@prodvm bin]# export MW_HOME=/u01/app/oracle/Middleware

[root@prodvm bin]# /u01/app/oracle/ovm-manager-3/ovm_upgrade/bin/ovmkeytool.sh setupWebLogic
Jan 31, 2018 9:21:28 PM oracle.security.jps.JpsStartup start
INFO: Jps initializing.
Jan 31, 2018 9:21:30 PM oracle.security.jps.JpsStartup start
INFO: Jps started.
Updating keystore information in WebLogic
Oracle MiddleWare Home (MW_HOME): [/u01/app/oracle/Middleware]
WebLogic domain directory: [/u01/app/oracle/ovm-manager-3/domains/ovm_domain]
WebLogic server name: [AdminServer]
WebLogic username: [weblogic]
WebLogic password: [********]
WLST session logged at: /tmp/wlst-session9182349945607884673.log

[root@prodvm bin]# sh /u01/app/oracle/ovm-manager-3/bin/configure_client_cert_login.sh

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

2018-01-31 21:24:05,924 [main] INFO  ovm.wlst.commands - Connecting using URL t3://localhost:7001

2018-01-31 21:24:12,426 [main] INFO  ovm.wlst.commands - Undeploying ovm_console
Undeploying application ovm_console ...
<Jan 31, 2018 9:24:13 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating undeploy operation for application, ovm_console [archive: null], to AdminServer .>
.Completed the undeployment of Application with status completed
Current Status of your Deployment:
Deployment command type: undeploy
Deployment State : completed
Deployment Message : no message
2018-01-31 21:24:17,551 [main] INFO  ovm.wlst.commands - Undeploying ovm_core
Undeploying application ovm_core ...
<Jan 31, 2018 9:24:17 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating undeploy operation for application, ovm_core [archive: null], to AdminServer .>
.Completed the undeployment of Application with status completed
Current Status of your Deployment:
Deployment command type: undeploy
Deployment State : completed
Deployment Message : no message
2018-01-31 21:24:21,013 [main] INFO  ovm.wlst.domainbuilder.Domain - Stopping AdminServer...
Stopping Weblogic Server...

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server "AdminServer" that belongs to domain "ovm_domain".

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

Shutting down the server AdminServer with force=false while connected to AdminServer ...
.........Disconnected from weblogic server: AdminServer


Exiting WebLogic Scripting Tool.

WLST lost connection to the WebLogic Server that you were
connected to, this may happen if the server was shutdown or
partitioned. You will have to re-connect to the server once the
server is available.
Disconnected from weblogic server: AdminServer
Done
Stopping Derby Server...
Derby server stopped.
2018-01-31 21:24:52,767 [main] INFO  ovm.wlst.domainbuilder.Domain - Starting AdminServer...
2018-01-31 21:24:52,916 [main] INFO  ovm.wlst.domainbuilder.Domain - Trying to connect to t3://localhost:7001...
2018-01-31 21:25:03,477 [main] INFO  ovm.wlst.domainbuilder.Domain - Trying to connect to t3://localhost:7001...
2018-01-31 21:25:15,962 [main] INFO  ovm.wlst.domainbuilder.Domain - Trying to connect to t3://localhost:7001...
2018-01-31 21:25:27,695 [main] INFO  ovm.wlst.domainbuilder.Domain - Trying to connect to t3://localhost:7001...
2018-01-31 21:25:38,798 [main] INFO  ovm.wlst.domainbuilder.Domain - Trying to connect to t3://localhost:7001...
2018-01-31 21:25:50,184 [main] INFO  ovm.wlst.domainbuilder.Domain - Trying to connect to t3://localhost:7001...
2018-01-31 21:26:02,377 [main] INFO  ovm.wlst.domainbuilder.Domain - Trying to connect to t3://localhost:7001...
2018-01-31 21:26:13,579 [main] INFO  ovm.wlst.domainbuilder.Domain - Trying to connect to t3://localhost:7001...

2018-01-31 21:26:14,936 [main] INFO  ovm.wlst.domainbuilder.Domain - Connected.
2018-01-31 21:26:14,971 [main] INFO  ovm.wlst.domainbuilder.Domain - AdminServer state is RUNNING
2018-01-31 21:26:14,973 [main] INFO  ovm.wlst.commands - Deploying ovm_core
Deploying application from /u01/app/oracle/ovm-manager-3/ovm_wlst/deploy/ovm_core/app/ovm_core_3.4.4.1709.ear to targets AdminServer (upload=false) ...
<Jan 31, 2018 9:26:15 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, ovm_core [archive: /u01/app/oracle/ovm-manager-3/ovm_wlst/deploy/ovm_core/app/ovm_core_3.4.4.1709.ear], to AdminServer .>
.....Completed the deployment of Application with status completed
Current Status of your Deployment:
Deployment command type: deploy
Deployment State : completed
Deployment Message : no message
Already in Domain Config Tree


Already in Domain Config Tree


2018-01-31 21:26:31,460 [main] INFO  ovm.wlst.domainbuilder.Domain - Created a user named appframework
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/u01/app/oracle/ovm-manager-3/ovm_cli/lib/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/u01/app/oracle/Middleware/wlserver/modules/features/weblogic.server.merged.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Jan 31, 2018 9:26:32 PM oracle.security.jps.JpsStartup start
INFO: Jps initializing.
Jan 31, 2018 9:26:34 PM oracle.security.jps.JpsStartup start
INFO: Jps started.
2018-01-31 21:27:25,822 [main] INFO  com.oracle.appfw.ovm.ws.client.KeytoolHelper - Writing cacert.pem
2018-01-31 21:27:25,824 [main] INFO  com.oracle.appfw.ovm.ws.client.KeytoolHelper - Importing cacert.pem with alias ovmca
2018-01-31 21:27:26,213 [main] INFO  com.oracle.appfw.ovm.ws.client.KeytoolHelper - Generating key pair for appframework in /u01/app/oracle/ovm-manager-3/domains/ovm_domain/security/ovmclient.jks
2018-01-31 21:27:27,025 [main] INFO  com.oracle.appfw.ovm.ws.client.KeytoolHelper - Exporting clientcert.pem from /u01/app/oracle/ovm-manager-3/domains/ovm_domain/security/ovmclient.jks
2018-01-31 21:27:27,234 [main] INFO  com.oracle.appfw.ovm.ws.client.KeytoolHelper - Reading clientcert.pem
2018-01-31 21:27:27,236 [main] INFO  com.oracle.appfw.ovm.ws.client.SSLClientUtil - Signing certificate
2018-01-31 21:27:27,588 [main] INFO  com.oracle.appfw.ovm.ws.client.KeytoolHelper - Writing clientcert.pem
2018-01-31 21:27:27,589 [main] INFO  com.oracle.appfw.ovm.ws.client.KeytoolHelper - Importing clientcert.pem with alias appframework
2018-01-31 21:27:28,132 [main] INFO  com.oracle.appfw.ovm.ws.client.SSLClientUtil - Deleting cacert.pem
2018-01-31 21:27:28,132 [main] INFO  com.oracle.appfw.ovm.ws.client.SSLClientUtil - Deleting clientcert.pem
2018-01-31 21:27:28,163 [main] INFO  ovm.wlst.commands - Deploying ovm_console
Deploying application from /u01/app/oracle/ovm-manager-3/ovm_wlst/deploy/ovm_console/app/ovm_console_3.4.4.1709.ear to targets AdminServer (upload=false) ...
<Jan 31, 2018 9:27:28 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, ovm_console [archive: /u01/app/oracle/ovm-manager-3/ovm_wlst/deploy/ovm_console/app/ovm_console_3.4.4.1709.ear], to AdminServer .>
.....Completed the deployment of Application with status completed
Current Status of your Deployment:
Deployment command type: deploy
Deployment State : completed
Deployment Message : no message
<Jan 31, 2018 9:27:43 PM IST> <Warning> <JNDI> <BEA-050001> <WLContext.close() was called in a different thread than the one in which it was created.>

Client certificate login configuration complete

[root@prodvm bin]# service ovmm stop
Stopping Oracle VM Manager                                 [  OK  ]

[root@prodvm bin]# service ovmm start
Starting Oracle VM Manager                                 [  OK  ]


After that we have to take care few steps mentioned in Doc ID 2038168.1

Which resolved our issue.


Thanks,

APEX url not working .. Issue with XDB listener


APEX url not working .. Issue with XDB services not getting registered with the listener.


SQL> select dbms_xdb.gethttpport() from dual;

DBMS_XDB.GETHTTPPORT()
----------------------
                  8020

SQL> show parameter shared_servers;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
max_shared_servers                   integer
shared_servers                       integer     1

SQL> alter system register;

System altered.

SQL> select * from dba_errors;

no rows selected

SQL> select count(*) from dba_objects where owner='XDB' and status='INVALID';

  COUNT(*)
----------
         0

SQL> select comp_name, status, version from DBA_REGISTRY  where comp_name='Oracle XML Database';

COMP_NAME
--------------------------------------------------------------------------------
STATUS                                       VERSION
-------------------------------------------- ------------------------------
Oracle XML Database
VALID                                        12.2.0.1.0


SQL> exec dbms_xdb.sethttpport(8020);

PL/SQL procedure successfully completed.

SQL> alter system register;

System altered.

SQL> show parameter dispatchers

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dispatchers                          string      (PROTOCOL=TCP) (SERVICE=prodapexXDB)
max_dispatchers                      integer

SQL> show parameter local_listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string      LISTENER_PRODAPEX


SQL> alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=prodapex)(port=1521))';

System altered.

SQL> show parameter local_listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string      (ADDRESS=(PROTOCOL=TCP)(HOST=prodapex)(port=1521))

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

[oracle@prodapex product]$ lsnrctl stop prodapex

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.4.203)(PORT=1521)))
The command completed successfully

SQL> startup

Total System Global Area 1.0066E+10 bytes
Fixed Size                 12169992 bytes
Variable Size            2248150264 bytes
Database Buffers         7784628224 bytes
Redo Buffers               21381120 bytes
Database mounted.
Database opened.

[oracle@prodapex product]$ lsnrctl start prodapex


Starting /u01/app/oracle/product/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/prodapex/prodapex/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.4.203)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.4.203)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     prodapex
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                01-FEB-2018 21:40:32
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/prodapex/prodapex/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.4.203)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "prodapex" has 1 instance(s).
  Instance "prodapex", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


SQL> alter system register;

System altered.



[oracle@prodapex product]$ lsnrctl status prodapex


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.4.203)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     prodapex
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                01-FEB-2018 21:40:32
Uptime                    0 days 0 hr. 1 min. 18 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/prodapex/prodapex/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.4.203)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=prodapex.example.com)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/prodapex/xdb_wallet))(Presentation=HTTP)(Session=RAW))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=prodapex.example.com)(PORT=8020))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "prodapex" has 1 instance(s).
  Instance "prodapex", status UNKNOWN, has 1 handler(s) for this service...
Service "prodapex.example.com" has 1 instance(s).
  Instance "prodapex", status READY, has 1 handler(s) for this service...
Service "prodapexXDB.flex.com" has 1 instance(s).
  Instance "prodapex", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@prodapex product]$

After this steps URL started working fine.

Thanks,

Migration Database from One machine to another using user managed backup.

Migration Database from One machine to another using user managed backup.

( Please note same OS , same version )


Migration Database from One machine to another using user managed backup.


Put the database in begin backup mode and copy all the datafiles,tempfiles,undo files on another server.

SQL> alter database begin backup;

Database altered.

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
/u04/app/oracle/oradata/prod11/users01.dbf
/u04/app/oracle/oradata/prod11/undotbs01.dbf
/u04/app/oracle/oradata/prod11/sysaux01.dbf
/u04/app/oracle/oradata/prod11/system01.dbf


[oracle@stand oracle]$ cd /u04/app/oracle/oradata/prod11
[oracle@stand prod11]$ ls -ltr
total 1347560
-rw-r----- 1 oracle oinstall  20979712 Jun  8 13:26 temp01.dbf
-rw-r----- 1 oracle oinstall  52429312 Jun  8 13:30 redo03.log
-rw-r----- 1 oracle oinstall  52429312 Jun  8 13:30 redo01.log
-rw-r----- 1 oracle oinstall   5251072 Jun  8 13:33 users01.dbf
-rw-r----- 1 oracle oinstall  31465472 Jun  8 13:33 undotbs01.dbf
-rw-r----- 1 oracle oinstall 702554112 Jun  8 13:33 system01.dbf
-rw-r----- 1 oracle oinstall 461381632 Jun  8 13:33 sysaux01.dbf
-rw-r----- 1 oracle oinstall  52429312 Jun  8 13:33 redo02.log
-rw-r----- 1 oracle oinstall   9748480 Jun  8 13:34 control02.ctl
-rw-r----- 1 oracle oinstall   9748480 Jun  8 13:34 control01.ctl

[oracle@stand prod11]$ scp -r *.dbf oracle@prod.som.com:/u04/app/oracle/oradata/prod11

Please note - Control file and Redo log files we will copy once we will shutdown database here.


Test Case :

created a table and updated a row on the table.

[oracle@stand prod11]$ sqlplus '/as sysdba'

SQL> create table t ( name varchar2(10));

Table created.

SQL> insert into t values ('test');

1 row created.

SQL> shut immediate;
ORA-01149: cannot shutdown - file 1 has online backup set
ORA-01110: data file 1: '/u04/app/oracle/oradata/prod11/system01.dbf'

SQL> alter database end backup;

Database altered.

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

Now our current database shut down we will copy redo,archives,pfile,control file on other machine on same location:


[oracle@stand prod11]$ scp *.log oracle@prod.som.com:/u04/app/oracle/oradata/prod11

[oracle@stand prod11]$ scp *.ctl oracle@prod.som.com:/u04/app/oracle/oradata/prod11


[oracle@stand prod11]$ cd /u04/app/oracle/oraarch
[oracle@stand oraarch]$ ls -ltr
total 23372
-rw-r----- 1 oracle oinstall 23895040 Jun  8 13:30 1_2_1031837194.arc
-rw-r----- 1 oracle oinstall     1024 Jun  8 13:30 1_3_1031837194.arc
-rw-r----- 1 oracle oinstall     2048 Jun  8 13:30 1_4_1031837194.arc


[oracle@stand oraarch]$ scp * oracle@prod.som.com:/u04/app/oracle/oraarch/

[oracle@stand oraarch]$ cd $ORACLE_HOME/dbs
-rw-r--r-- 1 oracle oinstall      989 Jun  8 15:06 initprod11.ora
[oracle@stand dbs]$ scp initprod11.ora oracle@prod.som.com:/u04/app/oracle/11g/dbs/



On New machine now :

Now all the files ( redo,archives,control files and pfile ) copied we will startup the other machine database.


SQL> startup nomount pfile='initprod11.ora';
ORACLE instance started.

Total System Global Area  379965440 bytes
Fixed Size                  2213576 bytes
Variable Size             121637176 bytes
Database Buffers          251658240 bytes
Redo Buffers                4456448 bytes

SQL> alter database mount;

Database altered.

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u04/app/oracle/oradata/prod11/system01.dbf'


SQL> recover database;
Media recovery complete.

SQL> alter database open;

Database altered.

SQL> select * from t;

NAME
----------
test


Hope this test case help to migrate the database from other machince.


Thanks.