Quantcast
Channel: EasyOraDBA
Viewing all 263 articles
Browse latest View live

Script to SET NEWNAME for DATAFILES in RMAN for Cloning

$
0
0

— If doing on Source Server —

::12c–>sqlplus “/as sysdba”

set head off pages 0 feed off echo off verify off
set lines 200
spool rename_datafiles.lst
select ‘set newname for datafile ‘ || file_id || ‘ to ”/u01/oradata/’ ||
substr(file_name,instr(file_name,’/’,-1)+1) || ”’;’
from dba_data_files ;
spool off
exit;

— If doing on Target Server —

[oracle@testorcl ~]$ sqlplus “/as sysdba”

set head off pages 0 feed off echo off verify off
set lines 200
spool rename_datafiles.lst
select ‘set newname for datafile ‘ || file# || ‘ to ”/u01/oradata/’ ||
substr(name,instr(name,’/’,-1)+1) || ”’;’
from v$datafile ;
spool off
exit;



ORA-39071: Value for EXCLUDE is badly formed.

$
0
0

Oracle Database 101

Quick post more for myself as I seem to continually forget how to construct a proper EXCLUDE on the command line (no parameter file) on Linux with DataPump so here it is .

"exclude=SCHEMA:"IN('SCHEMA1','SCHEMA2')""

And yes the quotes before exclude and at the very end are required. This of course isn’t the only way but hopefully one I can remember.

View original post


ORA-29548 release of java system classes in the database (12.2.0.2.160419.1.6 ) does not match that of oracle executable (12.1.0.2.170418 1.6)

$
0
0

This error is mostly due to a mismatch in the Java system classes. It happened to us when we cloned a 12c Database which was on a lower home version to a 12c home on a higher version. It requires data patch to be run and rollback the old patch and apply the new JVM patch.

 

If it is a RAC database, put it in single instance mode by disabling cluster_database parameter and mount the database in upgrade exclusive mode.

 

SQL> show parameter cluster

 

NAME     TYPE VALUE
———————————— ———– ——————————
cluster_database     boolean TRUE
cluster_database_instances     integer 2
cluster_interconnects     string
SQL>

SQL>

SQL> alter system set cluster_database=false scope=spfile sid=’*’;

 

 

System altered.

 

SQL>

SQL>

SQL> shutdown immediate;

 

Database closed.

 

Database dismounted.

 

ORACLE instance shut down.

 

SQL>

SQL>

SQL> startup upgrade exclusive;

 

ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance

 

ORACLE instance started.

 

Total System Global Area 3.4360E+10 bytes
Fixed Size    5304248 bytes
Variable Size 1.8119E+10 bytes
Database Buffers 1.6173E+10 bytes
Redo Buffers   61804544 bytes

 

Database mounted.

 

Database opened.
SQL>

SQL>

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
nessy1::12c–> cd /u03/app/oracle/product/12.1.0.2/dbhome_1/OPatch

nessy1::12c–> ./datapatch -verbose

SQL Patching tool version 12.1.0.2.0 Production on Sat Aug 12 14:47:54 2017Copyright (c) 2012, 2017, Oracle.  All rights reserved.
Log file for this invocation: /u03/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_125122_2017_08_12_14_47_54/sqlpatch_invocation.log
Connecting to database…OKBootstrapping registry and package to current versions…doneDetermining current state…done
Current state of SQL patches:Patch 21171382 (AUTO DOP COMPUTES A HIGH DOP UNNECESSARILY):  Installed in the SQL registry onlyPatch 22674709 (Database PSU 12.1.0.2.160419, Oracle JavaVM Component (Apr2016)):  Installed in the SQL registry onlyPatch 25437695 (Database PSU 12.1.0.2.170418, Oracle JavaVM Component (APR2017)):  Installed in the binary registry onlyBundle series DBBP:  ID 170418 in the binary registry and ID 160419 in the SQL registry
Adding patches to installation queue and performing prereq checks…Installation queue:  The following patches will be rolled back:    22674709 (Database PSU 12.1.0.2.160419, Oracle JavaVM Component (Apr2016))    21171382 (AUTO DOP COMPUTES A HIGH DOP UNNECESSARILY)  The following patches will be applied:    25437695 (Database PSU 12.1.0.2.170418, Oracle JavaVM Component (APR2017))    25397136 (DATABASE BUNDLE PATCH 12.1.0.2.170418)
Installing patches…Patch installation complete.  Total patches installed: 4
Validating logfiles…Patch 22674709 rollback: SUCCESS  logfile: /u03/app/oracle/cfgtoollogs/sqlpatch/22674709/20057886/22674709_rollback_NESSY_2017Aug12_14_48_20.log (no errors)Patch 21171382 rollback: SUCCESS  logfile: /u03/app/oracle/cfgtoollogs/sqlpatch/21171382/19741104/21171382_rollback_NESSY_2017Aug12_14_49_09.log (no errors)Patch 25437695 apply: SUCCESS  logfile: /u03/app/oracle/cfgtoollogs/sqlpatch/25437695/21057393/25437695_apply_NESSY_2017Aug12_14_49_17.log (no errors)Patch 25397136 apply: SUCCESS  logfile: /u03/app/oracle/cfgtoollogs/sqlpatch/25397136/21145057/25397136_apply_NESSY_2017Aug12_14_49_17.log (no errors)SQL Patching tool complete on Sat Aug 12 14:49:54 2017nessy1::12c–>nessy1::12c–>nessy1::12c–>sqld

SQL*Plus: Release 12.1.0.2.0 Production on Sat Aug 12 14:50:05 2017

 

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

 

 

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

 

SQL>

SQL>

SQL> shutdown immediate;

 

Database closed.
Database dismounted.

 

ORACLE instance shut down.

 

SQL>

SQL>

SQL> startup;

 

ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance

 

ORACLE instance started.

 

Total System Global Area 3.4360E+10 bytes
Fixed Size    5304248 bytes
Variable Size 1.8119E+10 bytes
Database Buffers 1.6173E+10 bytes
Redo Buffers   61804544 bytes

 

Database mounted.

 

Database opened.
SQL>

SQL>

SQL> set lines 9990
SQL>

SQL>

 

SQLselect * from dba_registry;

 

 

COMP_ID       COMP_NAME       VERSION      STATUS  MODIFIED NAMESPACE       CONTROL SCHEMA PROCEDURE       STARTUP PARENT_ID       OTHER_SCHEMAS
—————————— ————————————————————————————————————————————————————————————————————————————————————— —————————— ———– —————————– —————————— ——————————————————————————————————————————– ——————————————————————————————————————————– ————————————————————- ——– —————————— —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————-
APEX       Oracle Application Express       4.2.5.00.08      VALID  02-JUL-2016 16:08:09 SERVER       SYS APEX_040200 VALIDATE_APEX       FLOWS_FILES
OLS       Oracle Label Security       12.1.0.2.0      VALID  02-JUL-2016 16:08:08 SERVER       SYS LBACSYS VALIDATE_OLS
DV       Oracle Database Vault       12.1.0.2.0      VALID  02-JUL-2016 16:08:09 SERVER       SYS DVSYS VALIDATE_DV       DVF
ORDIM       Oracle Multimedia       12.1.0.2.0      VALID  02-JUL-2016 16:08:05 SERVER       SYS ORDSYS VALIDATE_ORDIM       MDSYS,ORDDATA,ORDPLUGINS,SI_INFORMTN_SCHEMA
CONTEXT       Oracle Text       12.1.0.2.0      VALID  02-JUL-2016 16:08:05 SERVER       SYS CTXSYS VALIDATE_CONTEXT
OWM       Oracle Workspace Manager       12.1.0.2.0      VALID  02-JUL-2016 16:08:01 SERVER       SYS WMSYS VALIDATE_OWM
SDO       Spatial       12.1.0.2.0      VALID  02-JUL-2016 16:08:07 SERVER       SYS MDSYS VALIDATE_SDO       MDDATA,MDSYS,SPATIAL_CSW_ADMIN_USR,SPATIAL_WFS_ADMIN_USR
XDB       Oracle XML Database       12.1.0.2.0      VALID  02-JUL-2016 16:07:57 SERVER       SYS XDB DBMS_REGXDB.VALIDATEXDB       ANONYMOUS,XS$NULL
CATALOG       Oracle Database Catalog Views       12.1.0.2.0      VALID  02-JUL-2016 16:07:55 SERVER       SYS SYS DBMS_REGISTRY_SYS.VALIDATE_CATALOG
CATPROC       Oracle Database Packages and Types       12.1.0.2.0      VALID  02-JUL-2016 16:07:55 SERVER       SYS SYS DBMS_REGISTRY_SYS.VALIDATE_CATPROC       APPQOSSYS,DBSNMP,DIP,GSMADMIN_INTERNAL,ORACLE_OCM,OUTLN,SYSTEM
JAVAVM       JServer JAVA Virtual Machine       12.1.0.2.0      VALID  12-AUG-2017 14:49:17 SERVER       SYS SYS INITJVMAUX.VALIDATE_JAVAVM

 

COMP_ID       COMP_NAME       VERSION      STATUS  MODIFIED NAMESPACE       CONTROL SCHEMA PROCEDURE       STARTUP PARENT_ID       OTHER_SCHEMAS
—————————— ————————————————————————————————————————————————————————————————————————————————————— —————————— ———– —————————– —————————— ——————————————————————————————————————————– ——————————————————————————————————————————– ————————————————————- ——– —————————— —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————-
XML       Oracle XDK       12.1.0.2.0      VALID  02-JUL-2016 16:08:04 SERVER       SYS SYS XMLVALIDATE
CATJAVA       Oracle Database Java Packages       12.1.0.2.0      VALID  02-JUL-2016 16:08:04 SERVER       SYS SYS DBMS_REGISTRY_SYS.VALIDATE_CATJAVA
APS       OLAP Analytic Workspace       12.1.0.2.0      VALID  02-JUL-2016 16:08:06 SERVER       SYS SYS APS_VALIDATE
XOQ       Oracle OLAP API       12.1.0.2.0      VALID  02-JUL-2016 16:08:07 SERVER       SYS SYS XOQ_VALIDATE
RAC       Oracle Real Application Clusters       12.1.0.2.0      VALID  02-JUL-2016 16:08:09 SERVER       SYS SYS DBMS_CLUSTDB.VALIDATE

 

16 rows selected.

 

SQL>

SQL>

SQL>
SQL>

SQL>

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options


Send query result from Apex 5.0 application as HTML Email

$
0
0

Sreejith 's Blog

Recently I had a requirement to send a HTML based email from my apex application. The HTML content was actually the result of an sql query I run on my application database.

I used UTL_SMTP with database stored procedure to send mails in a plain text format already in my application.New requirement to send HTML based emails from UTL_SMTP looked bit complex and more coding effort. This can be easily achievable using APEX_MAIL.

To use APEX_MAIL package we have to configure Apex environment and database

http://docs.oracle.com/cd/E59726_01/doc.50/e39151/adm_wrkspc002.htm#AEADM29176

1. Enabling Network Services

If you are running Oracle Application Express with Oracle Database 11g or later, you must enable outbound mail. Starting with Oracle Database 11g Release 1 (11.1), the ability to interact with network services is disabled by default.

By default, the ability to interact with network services is disabled in Oracle Database 11g or later. Therefore, if you are running Oracle…

View original post 192 more words


Sending an Email from an Oracle Apex Application

$
0
0

jagdev's blog on database technology

Done it ..

1. Here is the customer feedback form – customer enters feedback text and presses submit feedback button

feedbackform

2. In the Action When Button Clicked section, set Action value equal to Defined by Dynamic Action

3. Create a Dynamic Action. In the When section set the following values:

Event: Click

Selection Type: Button

Button: SUBMIT (Submit Feedback)

4. Add a TRUE Action

5. Set Action=Execute PL/SQL code

6. Under Settings, add the following PL/SQL code (Note p-body has been assigned the feedback bind variable :P102_FEEDBACK so that whatever text is entered by the customer will be sent in the email

BEGIN
apex_mail.send(  p_to       => ‘receiver.co.uk’,   — change to your email address
p_from     => ‘sender.co.uk’, — change to a real senders email address
p_body     => :P102_FEEDBACK,         p_subj     => ‘My Plain text message’);
END;

7. Run the page. Add some feedback and press the submit feedback button.

8. Voila! Within…

View original post 22 more words


Advanced Queuing Dequeue Freeze

Restore RMAN to new server and refresh with Archivelog apply

$
0
0

Source Database
—————

::: Directory Structure :::
ORACLE_HOME : E:\oracle\product\10.2.0\db_1
RMAN Backup : E:\rman_backup_full
Control Files : E:\oradata\ecc
DataFiles: E:\oradata\ECC
Archivelog Destination: E:\archivelogs
adump : e:\oracle\product\10.2.0\admin\ecc\adump
bdump : e:\oracle\product\10.2.0\admin\ecc\bdump
cdump : e:\oracle\product\10.2.0\admin\ecc\cdump
udump : e:\oracle\product\10.2.0\admin\ecc\udump

1. create pfile=’E:\eccprod.ora’ from spfile;

 

2. rman target /

backup incremental level 0 TAG ‘ECC_DAILY_FULL’ database filesperset 4;
backup archivelog all not backed up 1 times;
exit;

 

3. Copy RMAN backup files and pfile to Target Database directory in same structure

 

Target Database
—————

::: Directory Structure :::
ORACLE_HOME : E:\oracle\product\10.2.0\db_1
Control Files : E:\oradata\ecc
RMAN Backup : E:\rman_backup_full
DataFiles: E:\oradata\ECC
Archivelog Destination: E:\archivelogs
adump : e:\oracle\product\10.2.0\admin\ecc\adump
bdump : e:\oracle\product\10.2.0\admin\ecc\bdump
cdump : e:\oracle\product\10.2.0\admin\ecc\cdump
udump : e:\oracle\product\10.2.0\admin\ecc\udump

Make sure RMAN directory structure and Datafiles and Control Files Directory structure is identical as Source DB server else you have to use DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT parameters

1. Create required folders in the Target database server

adump
bdump
cdump
udump

Control File Location
Datafile Location
Archivelog Location
RMAN backup location

 

——
|PFILE |
——

ecc.__db_cache_size=1342177280
ecc.__java_pool_size=8388608
ecc.__large_pool_size=8388608
ecc.__shared_pool_size=226492416
ecc.__streams_pool_size=16777216
*.audit_file_dest=’e:\oracle\product\10.2.0\admin\ecc\adump’
*.background_dump_dest=’e:\oracle\product\10.2.0\admin\ecc\bdump’
*.compatible=’10.2.0.5.0′
*.control_files=’e:\oradata\ecc\control01.ctl’,’e:\oradata\ecc\control02.ctl’,’e:\oradata\ecc\control03.ctl’
*.core_dump_dest=’e:\oracle\product\10.2.0\admin\ecc\cdump’
*.db_16k_cache_size=67108864
*.db_block_size=8192
*.db_domain=”
*.db_file_multiblock_read_count=16
*.DB_FILE_NAME_CONVERT=’eccstandby’,’ecc’
*.db_name=’ecc’
*.DB_UNIQUE_NAME=’ecc’
*.dispatchers='(PROTOCOL=TCP) (SERVICE=eccXDB)’
*.FAL_CLIENT=’ecc’
*.FAL_SERVER=’eccstandby’
*.global_names=TRUE
*.INSTANCE_NAME=’ecc’
*.job_queue_processes=20
*.LOG_ARCHIVE_CONFIG=’DG_CONFIG=(ecc,eccstandby)’
*.LOG_ARCHIVE_DEST_1=’LOCATION=E:\archivelogs VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ecc’
*.log_archive_dest_2=’SERVICE=eccstandby LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=eccstandby’
*.log_archive_dest_state_1=’enable’
*.log_archive_dest_state_2=’ENABLE’
*.LOG_ARCHIVE_FORMAT=’log%t_%s_%r.arc’
*.LOG_FILE_NAME_CONVERT=’ecc’,’eccstandby’
*.open_cursors=700
*.OPTIMIZER_INDEX_COST_ADJ=30
*.pga_aggregate_target=364904448
*.processes=250
*.REMOTE_LOGIN_PASSWORDFILE=’EXCLUSIVE’
*.SERVICE_NAMES=’ecc’
*.session_cached_cursors=100
*.sessions=280
*.sga_max_size=1677721600
*.sga_target=1677721600
*.STANDBY_FILE_MANAGEMENT=’AUTO’
*.undo_management=’AUTO’
*.undo_tablespace=’UNDOTBS1′
*.user_dump_dest=’e:\oracle\product\10.2.0\admin\ecc\udump’

 

 

2. Create a service using oradim (if on windows) or with the pfile startup database in nomount mode

 

oradim -NEW -SID ecc -SYSPWD sys123 -STARTMODE auto -PFILE e:\eccprod.ora

 

3. Restore Database

rman target /

restore database ;

 

4. Now copy the new archivelogs to the archivelog directory and do recovery

 

rman target /

RMAN> catalog start with ‘E:\archivelogs’;

searching for all files that match the pattern E:\archivelogs

List of Files Unknown to the Database
=====================================
File Name: E:\archivelogs\LOG1_53601_781008485.ARC
File Name: E:\archivelogs\LOG1_53602_781008485.ARC
File Name: E:\archivelogs\LOG1_53603_781008485.ARC
File Name: E:\archivelogs\LOG1_53604_781008485.ARC
File Name: E:\archivelogs\LOG1_53605_781008485.ARC
File Name: E:\archivelogs\LOG1_53606_781008485.ARC
File Name: E:\archivelogs\LOG1_53607_781008485.ARC
File Name: E:\archivelogs\LOG1_53608_781008485.ARC
File Name: E:\archivelogs\LOG1_53609_781008485.ARC
File Name: E:\archivelogs\LOG1_53610_781008485.ARC
File Name: E:\archivelogs\LOG1_53611_781008485.ARC
File Name: E:\archivelogs\LOG1_53612_781008485.ARC
File Name: E:\archivelogs\LOG1_53613_781008485.ARC
File Name: E:\archivelogs\LOG1_53614_781008485.ARC
File Name: E:\archivelogs\LOG1_53615_781008485.ARC
File Name: E:\archivelogs\LOG1_53616_781008485.ARC
File Name: E:\archivelogs\LOG1_53617_781008485.ARC
File Name: E:\archivelogs\LOG1_53618_781008485.ARC
File Name: E:\archivelogs\LOG1_53619_781008485.ARC
File Name: E:\archivelogs\LOG1_53620_781008485.ARC
File Name: E:\archivelogs\LOG1_53621_781008485.ARC
File Name: E:\archivelogs\LOG1_53622_781008485.ARC
File Name: E:\archivelogs\LOG1_53623_781008485.ARC
File Name: E:\archivelogs\LOG1_53624_781008485.ARC
File Name: E:\archivelogs\LOG1_53625_781008485.ARC
File Name: E:\archivelogs\LOG1_53626_781008485.ARC
File Name: E:\archivelogs\LOG1_53627_781008485.ARC
File Name: E:\archivelogs\LOG1_53628_781008485.ARC
File Name: E:\archivelogs\LOG1_53629_781008485.ARC
File Name: E:\archivelogs\LOG1_53630_781008485.ARC
File Name: E:\archivelogs\LOG1_53631_781008485.ARC
File Name: E:\archivelogs\LOG1_53632_781008485.ARC
File Name: E:\archivelogs\LOG1_53633_781008485.ARC
File Name: E:\archivelogs\LOG1_53634_781008485.ARC
File Name: E:\archivelogs\LOG1_53635_781008485.ARC
File Name: E:\archivelogs\LOG1_53636_781008485.ARC
File Name: E:\archivelogs\LOG1_53637_781008485.ARC

Do you really want to catalog the above files (enter YES or NO)?
cataloging files…
cataloging done

List of Cataloged Files
=======================
File Name: E:\archivelogs\LOG1_53601_781008485.ARC
File Name: E:\archivelogs\LOG1_53602_781008485.ARC
File Name: E:\archivelogs\LOG1_53603_781008485.ARC
File Name: E:\archivelogs\LOG1_53604_781008485.ARC
File Name: E:\archivelogs\LOG1_53605_781008485.ARC
File Name: E:\archivelogs\LOG1_53606_781008485.ARC
File Name: E:\archivelogs\LOG1_53607_781008485.ARC
File Name: E:\archivelogs\LOG1_53608_781008485.ARC
File Name: E:\archivelogs\LOG1_53609_781008485.ARC
File Name: E:\archivelogs\LOG1_53610_781008485.ARC
File Name: E:\archivelogs\LOG1_53611_781008485.ARC
File Name: E:\archivelogs\LOG1_53612_781008485.ARC
File Name: E:\archivelogs\LOG1_53613_781008485.ARC
File Name: E:\archivelogs\LOG1_53614_781008485.ARC
File Name: E:\archivelogs\LOG1_53615_781008485.ARC
File Name: E:\archivelogs\LOG1_53616_781008485.ARC
File Name: E:\archivelogs\LOG1_53617_781008485.ARC
File Name: E:\archivelogs\LOG1_53618_781008485.ARC
File Name: E:\archivelogs\LOG1_53619_781008485.ARC
File Name: E:\archivelogs\LOG1_53620_781008485.ARC
File Name: E:\archivelogs\LOG1_53621_781008485.ARC
File Name: E:\archivelogs\LOG1_53622_781008485.ARC
File Name: E:\archivelogs\LOG1_53623_781008485.ARC
File Name: E:\archivelogs\LOG1_53624_781008485.ARC
File Name: E:\archivelogs\LOG1_53625_781008485.ARC
File Name: E:\archivelogs\LOG1_53626_781008485.ARC
File Name: E:\archivelogs\LOG1_53627_781008485.ARC
File Name: E:\archivelogs\LOG1_53628_781008485.ARC
File Name: E:\archivelogs\LOG1_53629_781008485.ARC
File Name: E:\archivelogs\LOG1_53630_781008485.ARC
File Name: E:\archivelogs\LOG1_53631_781008485.ARC
File Name: E:\archivelogs\LOG1_53632_781008485.ARC
File Name: E:\archivelogs\LOG1_53633_781008485.ARC
File Name: E:\archivelogs\LOG1_53634_781008485.ARC
File Name: E:\archivelogs\LOG1_53635_781008485.ARC
File Name: E:\archivelogs\LOG1_53636_781008485.ARC
File Name: E:\archivelogs\LOG1_53637_781008485.ARC

RMAN> recover database;

Starting recover at 18-FEB-18
using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 53636 is already on disk as file E:\ARCHIVELOGS\LO
G1_53636_781008485.ARC
archive log thread 1 sequence 53637 is already on disk as file E:\ARCHIVELOGS\LO
G1_53637_781008485.ARC
archive log filename=E:\ARCHIVELOGS\LOG1_53636_781008485.ARC thread=1 sequence=5
3636
archive log filename=E:\ARCHIVELOGS\LOG1_53637_781008485.ARC thread=1 sequence=5
3637
unable to find archive log
archive log thread=1 sequence=53638
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 02/18/2018 16:04:01
RMAN-06054: media recovery requesting unknown log: thread 1 seq 53638 lowscn 857
961236

RMAN>

 

Database is now in incomplete recovery, after new archivelogs are generated do recovery again. You can keep doing this till you are ready to open database with resetlogs and startup in mount mode

 

rman target /

RMAN> catalog start with ‘E:\archivelogs’;

 

RMAN> recover database;

Starting recover at 18-FEB-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=269 devtype=DISK

starting media recovery

archive log thread 1 sequence 53638 is already on disk as file E:\ARCHIVELOGS\LO
G1_53638_781008485.ARC
archive log thread 1 sequence 53639 is already on disk as file E:\ARCHIVELOGS\LO
G1_53639_781008485.ARC
archive log filename=E:\ARCHIVELOGS\LOG1_53638_781008485.ARC thread=1 sequence=5
3638
archive log filename=E:\ARCHIVELOGS\LOG1_53639_781008485.ARC thread=1 sequence=5
3639
unable to find archive log
archive log thread=1 sequence=53640
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 02/18/2018 17:03:52
RMAN-06054: media recovery requesting unknown log: thread 1 seq 53640 lowscn 857
981603

RMAN> alter database open resetlogs;

database opened

RMAN> list incarnation;

ist of Database Incarnations
B Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
—— ——- ——– —————- — ———- ———-
1 ECC 1040999203 PARENT 1 07-JUL-10
2 ECC 1040999203 PARENT 583052 19-APR-12
3 ECC 1040999203 CURRENT 857981604 18-FEB-18

 

 

 

 

The post Restore RMAN to new server and refresh with Archivelog apply appeared first on EasyOraDBA.

Create ACFS Filesystem Oracle 12c Linux 12.1.0.2


Playing with oracle DB 18c on-premises before official release

Restore and Upgrade Oracle Database from 11gR2 to 12c from Exadata X4-2 to X7-2

$
0
0

Upgrade from Exadata X4-2 11g (11.2.0.4) to Exadata X7-2 12CR1 (12.1.0.2.0) : ASM to ASM

Oracle Database 11.2.0.3and 11.2.0.4 to Oracle 12.2.0.1 Direct upgrade is supported by Oracle. If you have Database lower than those version than you have to upgrade to 11.2.0.4 first and you can upgrade to 12cR2

In our Scenario We will Migrate and Upgrade from One Exadata machine (X4-2) to another Exadata machine (X7-2) from 11.2.0.4 to 12.1.0.2.0

Source Exadata Setup

———————-

RAC 2-Nodes

Hardware : X4-2

Image version: 12.1.2.3.5.170418

DB NAME : mob

DATABASE HOME VERSION: 11.2.0.4

GRID HOME VERSION : 12.1.0.2.0

ASM Diskgroups : +DATAC1, +RECOC1

Target Exadata Setup

—————–

RAC 2-Nodes

Hardware : X7-2

Image version: 18.1.4.0.0.180125.3

DB NAME: SWX

DATABASE HOME VERSION : 12.1.0.2.0

GRID HOME VERSION : 12.2.0.1.0

ASM Diskgroups : +DATAC1, +RECOC1

 

Presumptions

————

* Oracle Home (12.1.0.2.0) is installed on the Target Server with latest patches

* Both Exadata Servers are reachable from the Network to Copy the backup files

1. Take RMAN Backup of Source Database on X4-2 hardware

rman target / nocatalog

run

{

allocate channel swx1 DEVICE TYPE DISK ;

allocate channel swx2 DEVICE TYPE DISK ;

allocate channel swx3 DEVICE TYPE DISK ;

allocate channel swx4 DEVICE TYPE DISK ;

CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘/exabackups/rmanbkp/swx/autobackup_control_file_%F’;

CONFIGURE DEFAULT DEVICE TYPE TO DISK;

BACKUP DATABASE FORMAT ‘/exabackups/rmanbkp/swx/SWX_FULL_%s_%D_%M_%Y’ tag ‘SWX_DAILY_FULL_DB_BKP’;

BACKUP ARCHIVELOG ALL FORMAT ‘/exabackups/rmanbkp/swx/ARCH_%d_ALL_%s_%t’ tag ‘SWX_ARCH_LOG_BKP’;

}

SQL> create pfile=’/exabackups/rmanbkp/swx/swx_source.ora’ from spfile ;

2. Copy Backup from Source Server to Target Server

cd /exabackups/rmanbkp/swx

scp -r * oracle@qiibtstdbadm01.qiibonline.com:/u03/swx_today

3. Edit the Source pfile : swx_source.ora and change below parameters

Old pfile

———

swx1.__db_cache_size=9395240960

swx2.__db_cache_size=9395240960

swx1.__java_pool_size=33554432

swx2.__java_pool_size=33554432

swx1.__large_pool_size=67108864

swx2.__large_pool_size=67108864

swx2.__oracle_base=’/u02/app/oracle’#ORACLE_BASE set from environment

swx1.__oracle_base=’/u02/app/oracle’#ORACLE_BASE set from environment

swx1.__pga_aggregate_target=6006243328

swx2.__pga_aggregate_target=6006243328

swx1.__sga_target=11173625856

swx2.__sga_target=11173625856

swx1.__shared_io_pool_size=0

swx2.__shared_io_pool_size=0

swx1.__shared_pool_size=1577058304

swx2.__shared_pool_size=1577058304

swx1.__streams_pool_size=0

swx2.__streams_pool_size=0

*._client_enable_auto_unregister=TRUE

*.archive_lag_target=0

*.audit_file_dest=’/u02/app/oracle/admin/swx/adump’ ####### Change to Target Directory and Create teh Directory on OS ###########

*.audit_trail=’db’

*.cluster_database=TRUE ######## Set to FALSE ############

*.compatible=’11.2.0.4.0′ ######## Change to 12.1.0.2.0 ##########

*.control_files=’+datac1/swx/controlfile/current.346.853755085′,’+RECOC1/swx/controlfile/current.4208.853579009′ ########## Hash this #########

*.cpu_count=2

*.db_block_size=8192

*.db_create_file_dest=’+DATAC1′

*.db_create_online_log_dest_1=’+RECOC1′

*.db_domain=”

*.db_name=’swx’

*.db_recovery_file_dest=’+RECOC1′

*.db_recovery_file_dest_size=858993459200

*.diagnostic_dest=’/u02/app/oracle’ ########## Change to new target Oracle Base directory ############

*.dispatchers='(PROTOCOL=TCP) (SERVICE=swxXDB)’

swx2.instance_number=2

swx1.instance_number=1

*.java_jit_enabled=TRUE

*.log_archive_dest_1=’LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=SWX’

*.log_archive_format=’%t_%s_%r.arc’

swx1.log_archive_format=’%t_%s_%r.arc’

swx2.log_archive_format=’%t_%s_%r.arc’

*.log_archive_max_processes=8

*.log_archive_min_succeed_dest=1

swx1.log_archive_trace=0

swx2.log_archive_trace=0

*.sga_max_size=17179869184

*.sga_target=17179869184

*.open_cursors=300

*.processes=1500

*.remote_listener=’exaprod-scan:1521′ ########## Change to SCAN listener of Target DB #########

*.remote_login_passwordfile=’exclusive’

*.resource_manager_cpu_allocation=48

*.resource_manager_plan=’DEFAULT_PLAN’

*.sessions=1655

*.standby_file_management=’AUTO’

swx2.thread=2

swx1.thread=1

swx1.undo_tablespace=’UNDOTBS1′

swx2.undo_tablespace=’UNDOTBS2′

*.instance_number=2

Save the parameters and save pfile as swx_target.ora

New pfile : swx_target.ora

———

swx1.__db_cache_size=9395240960

swx2.__db_cache_size=9395240960

swx1.__java_pool_size=33554432

swx2.__java_pool_size=33554432

swx1.__large_pool_size=67108864

swx2.__large_pool_size=67108864

swx2.__oracle_base=’/u02/app/oracle’#ORACLE_BASE set from environment

swx1.__oracle_base=’/u02/app/oracle’#ORACLE_BASE set from environment

swx1.__pga_aggregate_target=6006243328

swx2.__pga_aggregate_target=6006243328

swx1.__sga_target=11173625856

swx2.__sga_target=11173625856

swx1.__shared_io_pool_size=0

swx2.__shared_io_pool_size=0

swx1.__shared_pool_size=1577058304

swx2.__shared_pool_size=1577058304

swx1.__streams_pool_size=0

swx2.__streams_pool_size=0

*._client_enable_auto_unregister=TRUE

*.archive_lag_target=0

*.audit_file_dest=’/u03/app/oracle/admin/swx/adump’ ####### Change to Target Directory and Create teh Directory on OS ###########

*.audit_trail=’db’

*.cluster_database=FALSE ######## Set to FALSE ############

*.compatible=’12.1.0.2.0′ ######## Change to 12.1.0.2.0 ##########

#*.control_files=’+datac1/swx/controlfile/current.346.853755085′,’+RECOC1/swx/controlfile/current.4208.853579009′ ########## Hash this #########

*.cpu_count=2

*.db_block_size=8192

*.db_create_file_dest=’+DATAC1′

*.db_create_online_log_dest_1=’+RECOC1′

*.db_domain=”

*.db_name=’swx’

*.db_recovery_file_dest=’+RECOC1′

*.db_recovery_file_dest_size=858993459200

*.diagnostic_dest=’/u03/app/oracle’ ########## Change to new target Oracle Base directory ############

*.dispatchers='(PROTOCOL=TCP) (SERVICE=swxXDB)’

swx2.instance_number=2

swx1.instance_number=1

*.java_jit_enabled=TRUE

*.log_archive_dest_1=’LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=SWX’

*.log_archive_format=’%t_%s_%r.arc’

swx1.log_archive_format=’%t_%s_%r.arc’

swx2.log_archive_format=’%t_%s_%r.arc’

*.log_archive_max_processes=8

*.log_archive_min_succeed_dest=1

swx1.log_archive_trace=0

swx2.log_archive_trace=0

*.sga_max_size=17179869184

*.sga_target=17179869184

*.open_cursors=300

*.processes=1500

*.remote_listener=’qiibtst-scan:1521′ ########## Change to SCAN listener of Target DB #########

*.remote_login_passwordfile=’exclusive’

*.resource_manager_cpu_allocation=48

*.resource_manager_plan=’DEFAULT_PLAN’

*.sessions=1655

*.standby_file_management=’AUTO’

swx2.thread=2

swx1.thread=1

swx1.undo_tablespace=’UNDOTBS1′

swx2.undo_tablespace=’UNDOTBS2′

*.instance_number=2

4. Start the Instance on Target Database using swx_target.ora pfile

Make sure you export ORACLE_HOME and ORACLE_SID environment variables properly before beginning

SQL> startup nomount pfile=’/u03/swx_today/swx_source.ora’;

rman target /

RMAN> restore controlfile from ‘/u03/swx_today/control_file_SWX_853579011_20180215_4985_1’;

Starting restore at 18-MAR-18

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=1140 instance=swx device type=DISK

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:07

output file name=+RECOC1/SWX/CONTROLFILE/current.654.971100501

Finished restore at 18-MAR-18

RMAN> alter database mount;

RMAN> catalog start with ‘/u03/swx_today’;

Starting implicit crosscheck backup at 18-MAR-18

allocated channel: ORA_DISK_1

allocated channel: ORA_DISK_2

allocated channel: ORA_DISK_3

allocated channel: ORA_DISK_4

Crosschecked 158 objects

Finished implicit crosscheck backup at 18-MAR-18

Starting implicit crosscheck copy at 18-MAR-18

using channel ORA_DISK_1

using channel ORA_DISK_2

using channel ORA_DISK_3

using channel ORA_DISK_4

Crosschecked 4 objects

Finished implicit crosscheck copy at 18-MAR-18

searching for all files in the recovery area

cataloging files…

no files cataloged

searching for all files that match the pattern /u03/swx_today

List of Files Unknown to the Database

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

File Name: /u03/swx_today/ARCH_SWX_ALL_4979_968178229

File Name: /u03/swx_today/control_file_SWX_853579011_20180215_4985_1

File Name: /u03/swx_today/SWX_FULL_4975_15_02_2018

File Name: /u03/swx_today/ARCH_SWX_ALL_4981_968178230

File Name: /u03/swx_today/ARCH_SWX_ALL_4978_968178229

File Name: /u03/swx_today/ARCH_SWX_ALL_4982_968178255

File Name: /u03/swx_today/autobackup_control_file_c-133836929-20180215-02

File Name: /u03/swx_today/autobackup_control_file_c-133836929-20180215-00

File Name: /u03/swx_today/SWX_FULL_4974_15_02_2018

File Name: /u03/swx_today/autobackup_control_file_c-133836929-20180215-01

File Name: /u03/swx_today/swx_source.ora

File Name: /u03/swx_today/SWX_FULL_4976_15_02_2018

File Name: /u03/swx_today/ARCH_SWX_ALL_4980_968178230

File Name: /u03/swx_today/ARCH_SWX_ALL_4983_968178258

Do you really want to catalog the above files (enter YES or NO)? YES

cataloging files…

cataloging done

List of Cataloged Files

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

File Name: /u03/swx_today/ARCH_SWX_ALL_4979_968178229

File Name: /u03/swx_today/control_file_SWX_853579011_20180215_4985_1

File Name: /u03/swx_today/SWX_FULL_4975_15_02_2018

File Name: /u03/swx_today/ARCH_SWX_ALL_4981_968178230

File Name: /u03/swx_today/ARCH_SWX_ALL_4978_968178229

File Name: /u03/swx_today/ARCH_SWX_ALL_4982_968178255

File Name: /u03/swx_today/autobackup_control_file_c-133836929-20180215-02

File Name: /u03/swx_today/autobackup_control_file_c-133836929-20180215-00

File Name: /u03/swx_today/SWX_FULL_4974_15_02_2018

File Name: /u03/swx_today/autobackup_control_file_c-133836929-20180215-01

File Name: /u03/swx_today/SWX_FULL_4976_15_02_2018

File Name: /u03/swx_today/ARCH_SWX_ALL_4980_968178230

File Name: /u03/swx_today/ARCH_SWX_ALL_4983_968178258

List of Files Which Were Not Cataloged

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

File Name: /u03/swx_today/swx_source.ora

RMAN-07517: Reason: The file header is corrupted

RMAN> restore database;

Starting restore at 18-MAR-18

using channel ORA_DISK_1

using channel ORA_DISK_2

using channel ORA_DISK_3

using channel ORA_DISK_4

allocated channel: ORA_SBT_TAPE_1

channel ORA_SBT_TAPE_1: SID=26 instance=swx device type=SBT_TAPE

channel ORA_SBT_TAPE_1: Data Protection for Oracle: version 7.1.0.0

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00003 to +DATAC1/swx/datafile/undotbs1.281.853578943

channel ORA_DISK_1: restoring datafile 00004 to +RECOC1/swx/datafile/audit_tbs.2213.871200459

channel ORA_DISK_1: reading from backup piece /u03/swx_today/SWX_FULL_4975_15_02_2018

channel ORA_DISK_2: starting datafile backup set restore

channel ORA_DISK_2: specifying datafile(s) to restore from backup set

channel ORA_DISK_2: restoring datafile 00001 to +DATAC1/swx/datafile/system.285.853578943

channel ORA_DISK_2: restoring datafile 00002 to +DATAC1/swx/datafile/sysaux.278.853578943

channel ORA_DISK_2: reading from backup piece /u03/swx_today/SWX_FULL_4976_15_02_2018

channel ORA_DISK_3: starting datafile backup set restore

channel ORA_DISK_3: specifying datafile(s) to restore from backup set

channel ORA_DISK_3: restoring datafile 00005 to +DATAC1/swx/datafile/undotbs2.351.853579027

channel ORA_DISK_3: restoring datafile 00006 to +DATAC1/swx/datafile/swx.345.853583217

channel ORA_DISK_3: reading from backup piece /u03/swx_today/SWX_FULL_4974_15_02_2018

channel ORA_DISK_1: piece handle=/u03/swx_today/SWX_FULL_4975_15_02_2018 tag=SWX_DAILY_FULL_DB_BKP

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:15

channel ORA_DISK_2: piece handle=/u03/swx_today/SWX_FULL_4976_15_02_2018 tag=SWX_DAILY_FULL_DB_BKP

channel ORA_DISK_2: restored backup piece 1

channel ORA_DISK_2: restore complete, elapsed time: 00:00:15

channel ORA_DISK_3: piece handle=/u03/swx_today/SWX_FULL_4974_15_02_2018 tag=SWX_DAILY_FULL_DB_BKP

channel ORA_DISK_3: restored backup piece 1

channel ORA_DISK_3: restore complete, elapsed time: 00:04:45

Finished restore at 18-MAR-18

RMAN> recover database;

Starting recover at 18-MAR-18

using channel ORA_DISK_1

using channel ORA_DISK_2

using channel ORA_DISK_3

using channel ORA_DISK_4

using channel ORA_SBT_TAPE_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=2 sequence=48891

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=43454

channel ORA_DISK_1: restoring archived log

archived log thread=2 sequence=48892

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=43455

channel ORA_DISK_1: reading from backup piece /u03/swx_today/ARCH_SWX_ALL_4983_968178258

channel ORA_DISK_1: piece handle=/u03/swx_today/ARCH_SWX_ALL_4983_968178258 tag=SWX_ARCH_LOG_BKP

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

archived log file name=+RECOC1/SWX/ARCHIVELOG/2018_03_18/thread_1_seq_43454.645.971100923 thread=1 sequence=43454

archived log file name=+RECOC1/SWX/ARCHIVELOG/2018_03_18/thread_2_seq_48891.642.971100923 thread=2 sequence=48891

channel default: deleting archived log(s)

archived log file name=+RECOC1/SWX/ARCHIVELOG/2018_03_18/thread_2_seq_48891.642.971100923 RECID=238985 STAMP=971100923

archived log file name=+RECOC1/SWX/ARCHIVELOG/2018_03_18/thread_2_seq_48892.639.971100923 thread=2 sequence=48892

channel default: deleting archived log(s)

archived log file name=+RECOC1/SWX/ARCHIVELOG/2018_03_18/thread_1_seq_43454.645.971100923 RECID=238987 STAMP=971100923

archived log file name=+RECOC1/SWX/ARCHIVELOG/2018_03_18/thread_1_seq_43455.648.971100923 thread=1 sequence=43455

channel default: deleting archived log(s)

archived log file name=+RECOC1/SWX/ARCHIVELOG/2018_03_18/thread_1_seq_43455.648.971100923 RECID=238988 STAMP=971100923

unable to find archived log

archived log thread=1 sequence=43456

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 03/18/2018 14:15:25

RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 43456 and starting SCN of 21582106266

RMAN> alter database open resetlogs;

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-00601: fatal error in recovery manager

RMAN-03004: fatal error during execution of command

ORA-03114: not connected to ORACLE

RMAN-03002: failure of sql statement command at 03/18/2018 14:15:42

ORA-01092: ORACLE instance terminated. Disconnection forced

ORA-00704: bootstrap process failure

ORA-00604: error occurred at recursive SQL level 2

ORA-00904: “I”.”UNUSABLEBEGINNING#”: invalid identifier

Process ID: 136136

Session ID: 1137 Serial number: 14577

sqlplus “/as sysdba”

Change control file information with new location after restore in pfile and start database again +RECOC1/SWX/CONTROLFILE/current.654.971100501

Also change CLUSTER_DATABASE to false in pfile

If you get any error like below error then copy the file to the dbs folder as init.ora

ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file ‘/u03/app/oracle/product/12.1.0.2/dbhome_1/dbs/initswx.ora’

$ cp -p /u03/swx_today/swx_source.ora /u03/app/oracle/product/12.1.0.2/dbhome_1/dbs/initswx.ora

sqlplus “/as sysdba”

SQL> startup upgrade;

$ cd $ORACLE_HOME/rdbms/admin

$ORACLE_HOME/perl/bin/perl catctl.pl -n 4 catupgrd.sql

Argument list for [catctl.pl]

SQL Process Count n = 4

SQL PDB Process Count N = 0

Input Directory d = 0

Phase Logging Table t = 0

Log Dir l = 0

Script s = 0

Serial Run S = 0

Upgrade Mode active M = 0

Start Phase p = 0

End Phase P = 0

Log Id i = 0

Run in c = 0

Do not run in C = 0

Echo OFF e = 1

No Post Upgrade x = 0

Reverse Order r = 0

Open Mode Normal o = 0

Debug catcon.pm z = 0

Debug catctl.pl Z = 0

Display Phases y = 0

Child Process I = 0

catctl.pl version: 12.1.0.2.0

Oracle Base = /u03/app/oracle

Analyzing file catupgrd.sql

Log files in /u03/app/oracle/product/12.1.0.2/dbhome_1/rdbms/admin

catcon: ALL catcon-related output will be written to catupgrd_catcon_227787.lst

catcon: See catupgrd*.log files for output generated by scripts

catcon: See catupgrd_*.lst files for spool files, if any

Number of Cpus = 2

SQL Process Count = 4

——————————————————

Phases [0-73] Start Time:[2018_03_18 14:39:13]

——————————————————

Serial Phase #: 0 Files: 1 Time: 105s

Serial Phase #: 1 Files: 5 Time: 22s

Restart Phase #: 2 Files: 1 Time: 0s

Parallel Phase #: 3 Files: 18 Time: 4s

Restart Phase #: 4 Files: 1 Time: 0s

Serial Phase #: 5 Files: 5 Time: 10s

Serial Phase #: 6 Files: 1 Time: 9s

Serial Phase #: 7 Files: 4 Time: 4s

Restart Phase #: 8 Files: 1 Time: 0s

Parallel Phase #: 9 Files: 62 Time: 12s

Restart Phase #:10 Files: 1 Time: 0s

Serial Phase #:11 Files: 1 Time: 8s

Restart Phase #:12 Files: 1 Time: 0s

Parallel Phase #:13 Files: 91 Time: 4s

Restart Phase #:14 Files: 1 Time: 0s

Parallel Phase #:15 Files: 111 Time: 8s

Restart Phase #:16 Files: 1 Time: 0s

Serial Phase #:17 Files: 3 Time: 0s

Restart Phase #:18 Files: 1 Time: 0s

Parallel Phase #:19 Files: 32 Time: 8s

Restart Phase #:20 Files: 1 Time: 0s

Serial Phase #:21 Files: 3 Time: 4s

Restart Phase #:22 Files: 1 Time: 0s

Parallel Phase #:23 Files: 23 Time: 43s

Restart Phase #:24 Files: 1 Time: 0s

Parallel Phase #:25 Files: 11 Time: 17s

Restart Phase #:26 Files: 1 Time: 0s

Serial Phase #:27 Files: 1 Time: 0s

Restart Phase #:28 Files: 1 Time: 0s

Serial Phase #:30 Files: 1 Time: 0s

Serial Phase #:31 Files: 257 Time: 12s

Serial Phase #:32 Files: 1 Time: 0s

Restart Phase #:33 Files: 1 Time: 0s

Serial Phase #:34 Files: 1 Time: 3s

Restart Phase #:35 Files: 1 Time: 0s

Restart Phase #:36 Files: 1 Time: 0s

Serial Phase #:37 Files: 4 Time: 31s

Restart Phase #:38 Files: 1 Time: 0s

Parallel Phase #:39 Files: 13 Time: 27s

Restart Phase #:40 Files: 1 Time: 0s

Parallel Phase #:41 Files: 10 Time: 3s

Restart Phase #:42 Files: 1 Time: 0s

Serial Phase #:43 Files: 1 Time: 4s

Restart Phase #:44 Files: 1 Time: 0s

Serial Phase #:45 Files: 1 Time: 3s

Serial Phase #:46 Files: 1 Time: 1s

Restart Phase #:47 Files: 1 Time: 0s

Serial Phase #:48 Files: 1 Time: 82s

Restart Phase #:49 Files: 1 Time: 0s

Serial Phase #:50 Files: 1 Time: 22s

Restart Phase #:51 Files: 1 Time: 0s

Serial Phase #:52 Files: 1 Time: 16s

Restart Phase #:53 Files: 1 Time: 0s

Serial Phase #:54 Files: 1 Time: 192s

Restart Phase #:55 Files: 1 Time: 0s

Serial Phase #:56 Files: 1 Time: 37s

Restart Phase #:57 Files: 1 Time: 0s

Serial Phase #:58 Files: 1 Time: 69s

Restart Phase #:59 Files: 1 Time: 0s

Serial Phase #:60 Files: 1 Time: 295s

Restart Phase #:61 Files: 1 Time: 0s

Serial Phase #:62 Files: 1 Time: 24s

Restart Phase #:63 Files: 1 Time: 0s

Serial Phase #:64 Files: 1 Time: 0s

Serial Phase #:65 Files: 1 Time: 11s

Serial Phase #:66 Files: 1 Time: 25s

Serial Phase #:67 Files: 1 Time: 1s

Serial Phase #:68 Files: 1 Time: 0s

Serial Phase #:69 Files: 1 Time: 27s

——————————————————

Phases [0-73] End Time:[2018_03_18 14:58:16]

——————————————————

Grand Total Time: 1145s

*** WARNING: ERRORS FOUND DURING UPGRADE ***

Due to errors found during the upgrade process, the post

upgrade actions in catuppst.sql have not been automatically run.

*** THEREFORE THE DATABASE UPGRADE IS NOT YET COMPLETE ***

1. Evaluate the errors found in the upgrade logs

and determine the proper action.

2. Execute the post upgrade script as described in Chapter 3

of the Database Upgrade Guide.

REASON:

catuppst.sql unable to run in Database: swx Id: 0

ERRORS FOUND: during upgrade CATCTL ERROR COUNT=5

——————————————————

Identifier XDB 18-03-18 02:47:25 Script = /u03/app/oracle/product/12.1.0.2/dbhome_

ERROR = [ORA-01917: user or role ‘ANONYMOUS’ does not exist ORA-06512: at line 7

ORA-06512: at line 15

]

STATEMENT = [declare

already_revoked exception;

pragma exception_init(already_revoked,-01927);

procedure revoke_inherit_privileges(user in varchar2) as

begin

execute immediate ‘revoke inherit privileges on user ‘||

dbms_assert.enquote_name(user)||’ from public’;

exception

when already_revoked then null;

end;

begin

revoke_inherit_privileges(‘xdb’);

revoke_inherit_privileges(‘anonymous’);

end;]

——————————————————

——————————————————

Identifier XDB 18-03-18 02:47:25 Script = /u03/app/oracle/product/12.1.0.2/dbhome_

ERROR = [ORA-06512: at line 7 ORA-06512: at line 15

]

STATEMENT = [as above]

——————————————————

——————————————————

Identifier XDB 18-03-18 02:47:25 Script = /u03/app/oracle/product/12.1.0.2/dbhome_

ERROR = [ORA-06512: at line 15]

STATEMENT = [as above]

——————————————————

——————————————————

Identifier ORDIM 18-03-18 02:50:44 Script = /u03/app/oracle/product/12.1.0.2/dbhome_

ERROR = [ORA-20000: Oracle XML Database component not valid. Oracle XML Database must be installed and valid prior to Oracle Multimedia install, upgrade, downgrade, or patch.

ORA-06512: at line 3

]

STATEMENT = [begin

IF dbms_registry.is_valid(‘XDB’,dbms_registry.release_version) != 1 THEN

raise_application_error(-20000,

‘Oracle XML Database component not valid. ‘||

‘Oracle XML Database must be installed and valid prior to Oracle Multimedia install, upgrade, downgrade, or patch.’);

END IF;

end;]

——————————————————

——————————————————

Identifier ORDIM 18-03-18 02:50:44 Script = /u03/app/oracle/product/12.1.0.2/dbhome_

ERROR = [installed and valid prior to Oracle Multimedia install, upgrade, downgrade, or patch.

ORA-06512: at line 3

]

STATEMENT = [as above]

——————————————————

——————————————————

Identifier ORDIM 18-03-18 02:50:44 Script = /u03/app/oracle/product/12.1.0.2/dbhome_

ERROR = [patch. ORA-06512: at line 3

]

STATEMENT = [as above]

——————————————————

——————————————————

Identifier ORDIM 18-03-18 02:50:44 Script = /u03/app/oracle/product/12.1.0.2/dbhome_

ERROR = [ORA-06512: at line 3]

STATEMENT = [as above]

——————————————————

LOG FILES: (catupgrd*.log)

Upgrade Summary Report Located in:

/u03/app/oracle/product/12.1.0.2/dbhome_1/cfgtoollogs/swx/upgrade/upg_summary.log

Grand Total Upgrade Time: [0d:0h:19m:5s]

sqlplus “/as sysdba”

SQL> @utlrp.sql

SQL> select * from dba_registry;

Verify all components are valid

OWB OWB 11.2.0.4.0 VALID 18-MAR-2018 15:02:31 SERVER SYS OWBSYS DBMS_OWB.VALIDATE

EM Oracle Enterprise Manager 11.2.0.4.0 VALID 24-AUG-2013 11:58:27 SERVER SYS SYSMAN

AMD OLAP Catalog 11.2.0.4.0 OPTION OFF 18-MAR-2018 14:46:55 SERVER SYS OLAPSYS CWM2_OLAP_INSTALLER.VALIDATE_CWM2_INSTALL

SDO Spatial 12.1.0.2.0 VALID 18-MAR-2018 15:02:30 SERVER SYS MDSYS VALIDATE_SDO MDDATA,MDSYS,SPATIAL_CSW_ADMIN_USR,SPATIAL_WFS_ADMIN_USR

ORDIM Oracle Multimedia 12.1.0.2.0 VALID 18-MAR-2018 15:02:29 SERVER SYS ORDSYS VALIDATE_ORDIM ORDDATA,ORDPLUGINS,SI_INFORMTN_SCHEMA

XDB Oracle XML Database 12.1.0.2.0 VALID 18-MAR-2018 15:02:28 SERVER SYS XDB DBMS_REGXDB.VALIDATEXDB XS$NULL

CONTEXT Oracle Text 12.1.0.2.0 VALID 18-MAR-2018 15:02:27 SERVER SYS CTXSYS VALIDATE_CONTEXT

OWM Oracle Workspace Manager 12.1.0.2.0 VALID 18-MAR-2018 15:02:25 SERVER SYS WMSYS VALIDATE_OWM

CATALOG Oracle Database Catalog Views 12.1.0.2.0 VALID 18-MAR-2018 15:02:23 SERVER SYS SYS DBMS_REGISTRY_SYS.VALIDATE_CATALOG

CATPROC Oracle Database Packages and Types 12.1.0.2.0 VALID 18-MAR-2018 15:02:23 SERVER SYS SYS DBMS_REGISTRY_SYS.VALIDATE_CATPROC APPQOSSYS,DBSNMP,DIP,GSMADMIN_INTERNAL,ORACLE_OCM,OUTLN,SYSTEM

JAVAVM JServer JAVA Virtual Machine 12.1.0.2.0 VALID 18-MAR-2018 15:02:26 SERVER SYS SYS INITJVMAUX.VALIDATE_JAVAVM

COMP_ID COMP_NAME VERSION STATUS MODIFIED NAMESPACE CONTROL SCHEMA PROCEDURE STARTUP PARENT_ID OTHER_SCHEMAS

—————————— ————————————————————————————————————————————————————————————————————————————————————— —————————— ———– ——————– —————————— ——————————————————————————————————————————– ——————————————————————————————————————————– ————————————————————- ——– —————————— —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————-

XML Oracle XDK 12.1.0.2.0 VALID 18-MAR-2018 15:02:27 SERVER SYS SYS XMLVALIDATE

CATJAVA Oracle Database Java Packages 12.1.0.2.0 VALID 18-MAR-2018 15:02:27 SERVER SYS SYS DBMS_REGISTRY_SYS.VALIDATE_CATJAVA

APS OLAP Analytic Workspace 12.1.0.2.0 VALID 18-MAR-2018 15:02:29 SERVER SYS SYS APS_VALIDATE

XOQ Oracle OLAP API 12.1.0.2.0 VALID 18-MAR-2018 15:02:30 SERVER SYS SYS XOQ_VALIDATE

RAC Oracle Real Application Clusters 12.1.0.2.0 VALID 18-MAR-2018 15:02:31 SERVER SYS SYS DBMS_CLUSTDB.VALIDATE

16 rows selected.

SQL>

The post Restore and Upgrade Oracle Database from 11gR2 to 12c from Exadata X4-2 to X7-2 appeared first on EasyOraDBA.

ORA-01103: database name ‘MW’ in control file is not ‘MWTST’

$
0
0

This error most likely occurred when you duplicated a database and the DB_NAME parameter in spfile is not matching the one in the control file. Sometimes it so happened that after duplicating the database name in SPFILE with which you started the instance with is not matching the one in the control file.

Explanation:
=====================

The database name in the controlfile is not consistent with the db_name
parameter in the init.ora file.

Solution Step 1:

Change the DB_NAME parameter in spfile and bounce the database

STARTUP NOMOUNT

ALTER SYSTEM SET DB_NAME=ORIGINAL_DBNAME SCOPE=spfile;

SHUTDOWN IMMEDIATE;

STARTUP MOUNT;

ALTER DATABASE OPEN RESETLOGS;

If you get like below error

ORA-19838: Cannot use this control file to open database then have to recreate the control file from trace . Go to Solution 2:

See Oracle support Doc ID 1906009.1

 

Solution Step 2:

 

Now the only way to bring up the cloned DB is to re-create controlfile from trace. Login to the source database and run below commands.

SQL> alter database backup controlfile to trace;

Check location of controlfile which is created to trace; checking in ALERT LOG

ALTER DATABASE BACKUP CONTROLFILE TO TRACE
Backup controlfile written to trace file /u02/app/oracle/diag/rdbms/mw/mw1/trace/mw1_ora_146366.trc

Then Copy/Edit the Details of ControlFile from the block like below.

[code language=”sql”]

CREATE CONTROLFILE SET DATABASE “MW” RESETLOGS FORCE LOGGING ARCHIVELOG
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 32
MAXLOGHISTORY 9344
LOGFILE
GROUP 1 (
‘+DATAC1/mwtst1/onlinelog/group_1.366.854619221’,
‘+RECOC1/mwtst1/onlinelog/group_1.504.854619221’
) SIZE 100M BLOCKSIZE 512,
GROUP 2 (
‘+DATAC1/mwtst1/onlinelog/group_2.367.854619389’,
‘+RECOC1/mwtst1/onlinelog/group_2.505.854619389’
) SIZE 100M BLOCKSIZE 512,
GROUP 3 (
‘+DATAC1/mwtst1/onlinelog/group_3.368.854619411’,
‘+RECOC1/mwtst1/onlinelog/group_3.506.854619411’
) SIZE 100M BLOCKSIZE 512,
GROUP 4 (
‘+DATAC1/mwtst1/onlinelog/group_4.365.854619175’,
‘+RECOC1/mwtst1/onlinelog/group_4.507.854619175’
) SIZE 100M BLOCKSIZE 512
DATAFILE
‘+DATAC1/mwtst1/datafile/SYSTEM.467.971185463’,
‘+DATAC1/mwtst1/datafile/SYSAUX.439.971266529’,
‘+DATAC1/mwtst1/datafile/USERS.473.971266529’,
‘+DATAC1/mwtst1/datafile/UNDOTBS1.468.971185463’,
‘+DATAC1/mwtst1/datafile/UNDOTBS2.466.971185463’,
‘+DATAC1/mwtst1/datafile/MQ.357.971266521’,
‘+RECOC1/mwtst1/datafile/AUDIT_TBS.1787.971185463′
CHARACTER SET AL32UTF8
;

[/code]

Save it as control_file.sql

Ensure you check the Datafile location and name, it should be same as in what resides on your filesystem. This is specially true when you using ASM and OMF together.

 

Now start the instance

 

SQL> startup nomount

SQL> @control_file.sql

Control file created.

SQL> alter database open resetlogs;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
——————–
READ WRITE

SQL> select open_mode,name from v$database;

OPEN_MODE NAME
——————– ———
READ WRITE MW

SQL> select * from v$controlfile;

STATUS
——-
NAME
——————————————————————————–
IS_ BLOCK_SIZE FILE_SIZE_BLKS
— ———- ————–

+RECOC1/mw/controlfile/current.2156.971360621
YES 16384 1878

Now change the database name in control file using nid utility

nid TARGET=system/****** DBNAME=MWTST SETNAME=Y

 

DBNEWID: Release 11.2.0.4.0 – Production on Wed Mar 21 14:27:18 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to database MW (DBID=1312370394)

Connected to server version 11.2.0

Control Files in database:
+RECOC1/mw/controlfile/current.2156.971360621

Change database name of database MW to MWTST? (Y/[N]) => Y

Proceeding with operation
Changing database name from MW to MWTST
Control File +RECOC1/mw/controlfile/current.2156.971360621 – modified
Datafile +DATAC1/mwtst1/datafile/system.467.97118546 – wrote new name
Datafile +DATAC1/mwtst1/datafile/sysaux.439.97126652 – wrote new name
Datafile +DATAC1/mwtst1/datafile/undotbs1.468.97118546 – wrote new name
Datafile +DATAC1/mwtst1/datafile/users.473.97126652 – wrote new name
Datafile +DATAC1/mwtst1/datafile/undotbs2.466.97118546 – wrote new name
Datafile +DATAC1/mwtst1/datafile/mq.357.97126652 – wrote new name
Datafile +RECOC1/mwtst1/datafile/audit_tbs.1787.97118546 – wrote new name
Control File +RECOC1/mw/controlfile/current.2156.971360621 – wrote new name
Instance shut down

Database name changed to MWTST.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID – Completed succesfully.

 

Change PARAMETER in PFILE or in Memory

SQL> alter system set db_name=’MWTST’ scope=spfile;

System altered.

SQL> show parameter cluster

NAME TYPE VALUE
———————————— ———– ——————————
cluster_database boolean FALSE
cluster_database_instances integer 1
cluster_interconnects string

 

SQL> alter system set db_unique_name=’MWTST’ scope=spfile;

SQL> shutdown immediate;

SQL> startup mount

SQL> alter database open;

Database altered.

SQL> select open_mode,name from v$database;

OPEN_MODE NAME
——————– ———
READ WRITE MWTST

 

 

 

 

 

The post ORA-01103: database name ‘MW’ in control file is not ‘MWTST’ appeared first on EasyOraDBA.

Add Background Image and Logo in CSS for Oracle Apex

$
0
0

So you have got your Oracle APEX instance up and running and you want to customize your first app. The easiest way to add logo and background image to your login page is by using CSS

Go to Page Desginer >  CSS > Inline and Add Below Code

span.t-Login-logo {
background-image: url(#WORKSPACE_IMAGES#whitehat.png);
backgroung-size: cover;
width: 150px;
height: 140px;
}

Screen Shot 2018-04-30 at 6.06.21 PM

## You can work out the Width and Height of your logo image accordingly

If you want to add a background to the login page as well..Then you can include above code along with background image code. So the total code in Inline CSS would look like below

 

span.t-Login-logo {
background-image: url(#WORKSPACE_IMAGES#whitehat.png);
backgroung-size: cover;
width: 150px;
height: 140px;
}

.t-Body {
background-image:url(#WORKSPACE_IMAGES#sydney_opera_house_australia-wallpaper-1920×1200.jpg);
background-repeat: no-repeat;
background-size : 100%;
background-position: 25%;
}

And the end result is a beautiful login page like below

Screen Shot 2018-04-30 at 6.11.38 PM

The post Add Background Image and Logo in CSS for Oracle Apex appeared first on EasyOraDBA.

Quick and Easy Integration with Twitter with Apex 18.1

Install NodeJS on CentOS 6 – 7

$
0
0

Install Latest NodeJS on CentOS 6 or 7
————————————–

1. Add Repo and Install NodeJS

For Stable Release:-

$ yum install -y gcc-c++ make
$ curl -sL https://rpm.nodesource.com/setup_8.x | sudo -E bash –

$ yum install nodejs

 

2. Check the version for Node and NPM

$ node -v

v8.11.1

$ npm -v

5.6.0

 

3. Create a Demo Server

$ vim demo_server.js

add below lines

var http = require(‘http’);
http.createServer(function (req, res) {
res.writeHead(200, {‘Content-Type’: ‘text/plain’});
res.end(‘Welcome To EasyOraDBA’);
}).listen(3005, “127.0.0.1”);
console.log(‘Server is running at http://127.0.0.1:3005/’);

4. Start the Node Server

[root@easyoradba CordovaApps]# node demo_server.js
Server is running at http://127.0.0.1:3005/

Go to your Browser and Paste the URL, your WebServer has been started on port 3005

The post Install NodeJS on CentOS 6 – 7 appeared first on EasyOraDBA.

Install NodeJS on Mac OS

$
0
0

To install NodeJS on a Mac the first thing you have to do is download Brew package manager for mac. Though you can install NodeJS via other methods but doing it with Brew is the easiest and least error prone method

1. Install Brew on your mac if you dont have it already. Open the terminal app and paste the below command (make sure you have the password for the user)

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

2. Now the Brew package manager is installed. Open terminal and type below command

brew install node

3. Check Versions of Node and NPM

node -v

npm -v

 

4. Create a Demo Web server and Check. Open terminal and type below

vim demo_server.js

— Paste below Code in the file —

var http = require(‘http’);
http.createServer(function (req, res) {
res.writeHead(200, {‘Content-Type’: ‘text/plain’});
res.end(‘Welcome To EasyOraDBA’);
}).listen(3005, “127.0.0.1”);
console.log(‘Server is running at http://127.0.0.1:3005/’);

 

node demo_server.js

— Now open a Web browser and paste the URL http://127.0.0.1:3005/ And voila you have a NodeJS Web Server running —

 

The post Install NodeJS on Mac OS appeared first on EasyOraDBA.


Install Oracle Apex 5.1.x on ORDS 3,17.4, 18.1

$
0
0

Oracle Apex is a modern framework to quickly develop and deploy web apps sitting on top of Oracle Database. Apex can be run directly from the database engine itself using a component called Mod PL/SQL. It is one of the easiest way to run Apex, but it is not a production ready setup. In a production scenario your database server should not be internet facing. The ideal design is a reverse proxy server facing the internet and a webserver sitting behind it and the DB server behind a firewall isolated from any public network.

Oracle has a modern gateway to do this, it is called ORDS( previously called Apex Listener). It stands for Oracle Rest Data Services. Not only it can help you host your apex instance in a Java web container like Tomcat, Glassfish, Weblogic but also it gives your developer access to build enterprise scale data access API’s. It can help you build your front-end in the modern JavaScript instead of the traditional programming languages. You can read about it more here : https://blogs.oracle.com/newgendbaccess/why-use-rest-and-ords-to-transform-your-oracle-database-into-a-restful-api-service

architecture big

Now to setup ORDS to host your Apex instance first we need to make sure you have 3 components

1. Oracle APEX itself, though from ORDS 17.1 it is not compulsory to have Apex installed, but i always prefer having it. Download the latest version from here : http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html

2. A Servlet web container like Tomcat, Glassfish or Weblogic. I prefer to use Tomcat since it is the easiest to setup, is open source and is quite lightweight. Apache tomcat can be downloaded from here  : https://tomcat.apache.org/download-90.cgi

3. ORDS, this is the most important component in this setup. Oracle has recently changed it’s numbering scheme. So it jumped from ORDS 3 to ORDS 17.4 and ORDS 18.1. It is now done using YY.MM naming convention. It can be downloaded from here : http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html

Let’s  Start with Installing Apache tomcat first on you server

                             1.  INSTALL APACHE TOMCAT

1. Create a user tomcat on the linux server which will be your webserver

useradd tomcat

2. Untar the file in the home directory or create a separate directory. To have a well defined structure i always prefer to have a directory structure like /u01/tomcat

tar xvf apache-tomcat-9.0.8.tar.gz

This will create the directory ‘apache-tomcat-9.0.8’ inside

go to the .bash_profile of tomcat user and add below for the home directory

PATH=$PATH:$HOME/bin:$CATALINA_HOME/bin
CATALINA_HOME=/u01/tomcat/apache-tomcat-9.0.8
export CATALINA_HOME
export PATH

. .bash_profile

3. Start Stop Apache Tomcat 9 snd enable Gui Access

sh $CATALINA_HOME/bin/shutdown.sh

sh $CATALINA_HOME/bin/startup.sh

You can now access the console of tomcat using http://localhost:8080/

To enable access to manager app and manager app gui. Add below to lines to file tomcat-users.xml

vi $CATALINA_HOME/conf/tomcat-users.xml

<role rolename=”manager-gui”/>
<user username=”tomcat” password=”Abc1234$#” roles=”manager-gui”/>
<role rolename=”admin-gui”/>
<user username=”tomcat” password=”Abc1234$#” roles=”admin-gui”/>

Save and restart Tomcat

                        2.   INSTALL ORACLE APEX 5.1.x

This installation has to be done on the DB Server. Copy your Apex zip file to Oracle Home Directory. Remove the existing Apex directory and unzip the fil

1.Install Apex Binary and Create Tablespace and Schema

cd $ORACLE_HOME

rm -rf apex/

unzip apex_5_0_1_en.zip

cd $ORACLE_HOME/apex

sqlplus “/as sysdba”

SQL> CREATE TABLESPACE APEX  DATAFILE ‘/u01/oradata/orcl/datafiles/apex01.dbf’ SIZE 1G AUTOEXTEND ON NEXT 10M;

SQL> @apexins.sql APEX APEX TEMP /i/

APEX – Tablespace to hold Apex Schema and its associated files

TEMP –  Temporary Tablespace

/i/ – It is  your image directory

Change your Admin password

SQL> @apxchpwd.sql

Create APEX_LISTENER and  APEX_REST_PUBLIC_USER

SQL> @apex_rest_config.sql

If you want to run the PL/SQL gateway continue to the next step else you can skip this and go to Step 3. directly

SQL> @apex_epg_config.sql /u01/app/oracle/product/12.2.0/dbhome_1

‘/u01/app/oracle/product/12.2.0/dbhome_1’ is the home directory of Oracle Database

SQL> ALTER USER ANONYMOUS ACCOUNT UNLOCK;

Check the HTTP Port,

SQL> SELECT DBMS_XDB.gethttpport FROM DUAL;

If this is 0 and you need to to install Apex with ORDS then goto Step 3. else continue and get the port

SQL> EXEC DBMS_XDB.sethttpport(8080);

SQL> SELECT DBMS_XDB.gethttpport FROM DUAL;

8080

The URL for Apex application now should be accessible from Web Browser http://localhost:8080/apex/apex_admin

              3. ORACLE REST DATA SERVICES (ORDS) CONFIGURATION & INSTALLATION

After downloading the ORDS to the server, go to the server where you installed Tomcat earlier

1.Unzip the ords zip file

cd /u01

mkdir -p /u01/ords

mkdir -p /u01/ords/conf

unzip ords.18.1.1.95.1251.zip

2. Login to DB Server SQL*PLUS and unlock the Apex  listener usernames and password to ensure ORDS installation goes smoothly

SQL> ALTER USER SYS IDENTIFIED BY abc123 ACCOUNT UNLOCK;

SQL> ALTER USER APEX_LISTENER IDENTIFIED BY abc123 ACCOUNT UNLOCK;
SQL> ALTER USER APEX_PUBLIC_USER IDENTIFIED BY abc123 ACCOUNT UNLOCK;
SQL> ALTER USER APEX_REST_PUBLIC_USER IDENTIFIED BY abc123 ACCOUNT UNLOCK;

SQL>ALTER USER ORDS_PUBLIC_USER IDENTIFIED BY abc123 ACCOUNT UNLOCK;

If last SQL command fails, it is because there is no ORDS schema yet.

3. Configure ORDS for Database connectivity. Go back to WebServer and there will be a ords.war file in /u01/ords

Edit the /u01/ords/params/ords_params.properties and set the parameters of your DB server and instance. Make sure there is network connectivity between DB Server and Web Server

cd /u01/ords

java -jar ords.war configdir /u01/ords/conf

java -jar ords.war

Don’t select Standalone option in the last, just press 2 and exit. Standlone server is a quick Jetty webserver build in ORDS. But its not the best production setup, hosting on Apache Tomcat is better.

mkdir $CATALINA_HOME/webapps/i/

Copy the image directory from the Apex installation in DB Server to Tomcat image directory.

cp -R $ORACLE_HOME/apex/images/* $CATALINA_HOME/webapps/i/

Copy the ords.war file from /u01/ords to Webapps directory of tomcat

cd /u01/ords
cp ords.war $CATALINA_HOME/webapps/

ORDS should now be accessible on URL http://localhost:8080/ords

Remember to remove the port 8080 configuration from Embedded PL/SQL gateway, if you did Step 2. and are moving to ORDS from PL/SQL Gateway

SQL> EXEC DBMS_XDB.sethttpport(0);

SQL> SELECT DBMS_XDB.gethttpport FROM DUAL;

0

And try URL again : http://localhost:8080/ords

Error 1 :

Oracle Rest Data Services 404 Not Found When Running APEX – PL/SQL Gateway Configured

Check APEX_PUBLIC_USER account and unlock it, stop and start Apache tomcat and try again. Or maybe an incorrect APEX_PUBLIC_USER password was entered during ORDS configuration. reconfigure the ords.war using below command:

java -jar ords.war setup

And copy new war file to webapps directory again and access URL again

http://localhost:8080/ords

Reference : Oracle Rest Data Services 404 Not Found When Running APEX – PL/SQL Gateway Configured (Doc ID 2048493.1)

Error 2:

Server isn’t redirecting oracle apex ords on Firefox

This page isn’t working
<hostname> redirected you too many times.

Try clearing the cookies and try again. Most likely close the browser windows and open and again and the error will go away

http://localhost:8080/ords

Reference: Problem Accessing APEX Application Using ORDS 3.0.9.348.07.16 (Doc ID 2280694.1)

Summary :

1.Steps to do when installing only PL/SQL gateway

1 > 2

2. Steps when upgrading from PL/SQL Gateway to ORDS

1 > 3

3. Steps when doing fresh new install of ORDS

1 > 2 > 3

The post Install Oracle Apex 5.1.x on ORDS 3,17.4, 18.1 appeared first on EasyOraDBA.

Install mysql database along with phpadmin on CENTOS 6 7

$
0
0

Mysql is the most popular open database and is the M in the LAMP stack (others being Linux-Apache-PHP)

If your on CentOS and your linux server is connected to the internet installing mysql is just a few terminal commands

1. Install the LAMP stack via yum

$ yum install httpd mysql-server php php-mysql

2. Configure the LAMP Stack

$ service httpd start

Now you should have a webserver up and running on http://localhost/

3. Start and secure your mysql database by executing below script

$ service mysqld start

$ mysql_secure_installation

Securing your database is very important, specially if your deploying a productions database

4. Install phpmyadmin

Install the EPEL Repo, if your on CentOS 6

$ wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -ivh epel-release-6-8.noarch.rpm

if your on CentOS 7

$ wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ rpm -ivh epel-release-latest-7.noarch.rpm

Now install phpmyadmin

$ yum install phpmyadmin

If you want access to phpmyadmin from other computers edit below file and add the host ip’s

$ vi /etc/httpd/conf.d/phpMyAdmin.conf

Require ip <other workstation ip>

Allow from <other workstation ip>

Restart httpd services

$ service httpd restart

You can now access using below URL

http://localhost/phpmyadmin

Enter your root username and password and you now have a nice GUI to manage your mysql instance

The post Install mysql database along with phpadmin on CENTOS 6 7 appeared first on EasyOraDBA.

Generate REST API from mysql database in less than 5 minutes

$
0
0

Representation State Transfer is the new industry standard of building technology neutral API’s. REST API are essentially web services to read or transfer data. REST API’s can be build on top of most relational databases. Mysql being the most popular database around. If you have nodejs and mysql already installed, you can build a REST API for your mysql db in less than 2 minutes 🙂

Before we begin we must have nodejs and mysql running on the server. If you don’t have nodejs, you can check my other article on how to install node.js on Cent OS Linux : https://easyoradba.com/2018/05/08/install-nodejs-on-centos-6-7/

And to quickly install mysql refer to my another of my blog posts 🙂 https://easyoradba.com/2018/05/18/install-mysql-database-along-with-phpadmin-on-centos-6-7/

Once you have mysql and nodejs setup. You can install and spin up  REST API’s doing the below steps

1.Install xmysql using node package manager

$ npm install -g xmysql

2. Create a new user, a new test database and a new table with few records

mysql -u root -p

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘test’@’localhost’ IDENTIFIED BY ‘test123’;

mysql> CREATE DATABASE easyoradba;

mysql> USE easyoradba;

mysql> CREATE TABLE emp ( id smallint unsigned not null auto_increment, name varchar(20) not null, constraint pk_example primary key (id) );

mysql> INSERT INTO emp ( id, name ) VALUES ( null, ‘SHADAB’ );

mysql> select * from emp;
+—-+——–+
| id | name |
+—-+——–+
| 1 | SHADAB |
+—-+——–+
1 row in set (0.00 sec)

mysql> exit;

3. Generate the REST API for db ‘easyoradba’ using xmysql

$ xmysql -h localhost -u test -p test123 -d easyoradba -n 8899 -r 192.168.1.46

Generating REST APIs at the speed of your thought..

– – – – – – – – – – – – – – – – – – – – – – – – – – – – – –

Database : easyoradba
Number of Tables : 1

REST APIs Generated : 19

Xmysql took : 0.3 seconds

– – – – – – – – – – – – – – – – – – – – – – – – – – – – – –

-h hostname of your mysql DB server

-u username of mysql

-p password for mysql user

-d DB name for which API needs to be generated

-n port number to create the REST service

-r your server IP, if left blank it will create with default value localhost

4. Check the REST API service and Call it from Postman

Go to browser and check the ip with defined port number : http://192.168.1.46:8899/

[{“resource”:”emp”,”routes”:[{“httpType”:”get”,”routeUrl”:”http://192.168.1.46:8899/api/emp/describe”},{“httpType”:”get”,”routeUrl”:”http://192.168.1.46:8899/api/emp/count”},{“httpType”:”get”,”routeUrl”:”http://192.168.1.46:8899/api/emp/groupby”},{“httpType”:”get”,”routeUrl”:”http://192.168.1.46:8899/api/emp/distinct”},{“httpType”:”get”,”routeUrl”:”http://192.168.1.46:8899/api/emp/ugroupby”},{“httpType”:”get”,”routeUrl”:”http://192.168.1.46:8899/api/emp/chart”},{“httpType”:”get”,”routeUrl”:”http://192.168.1.46:8899/api/emp/aggregate”},{“httpType”:”get”,”routeUrl”:”http://192.168.1.46:8899/api/emp/findOne”},{“httpType”:”get”,”routeUrl”:”http://192.168.1.46:8899/api/emp/autoChart”},{“httpType”:”post”,”routeUrl”:”http://192.168.1.46:8899/api/emp”},{“httpType”:”get”,”routeUrl”:”http://192.168.1.46:8899/api/emp”},{“httpType”:”post”,”routeUrl”:”http://192.168.1.46:8899/api/emp/bulk”},{“httpType”:”delete”,”routeUrl”:”http://192.168.1.46:8899/api/emp/bulk”},{“httpType”:”get”,”routeUrl”:”http://192.168.1.46:8899/api/emp/bulk”},{“httpType”:”put”,”routeUrl”:”http://192.168.1.46:8899/api/emp”},{“httpType”:”patch”,”routeUrl”:”http://192.168.1.46:8899/api/emp/:id”},{“httpType”:”delete”,”routeUrl”:”http://192.168.1.46:8899/api/emp/:id”},{“httpType”:”get”,”routeUrl”:”http://192.168.1.46:8899/api/emp/:id”},{“httpType”:”get”,”routeUrl”:”http://192.168.1.46:8899/api/emp/:id/exists”}]},”http://192.168.1.46:8899/api/tables”,”http://192.168.1.46:8899/api/xjoin”,”http://192.168.1.46:8899/api/dynamic”,”/upload”,”/uploads”,”/download”]

Open Postman and call the URL with GET method to fetch the data

Screen Shot 2018-05-18 at 2.17.30 PM

 

And voila ! There you have it an REST API running on top of a mysql database in less than 5 minutes :)))

 

 

 

The post Generate REST API from mysql database in less than 5 minutes appeared first on EasyOraDBA.

Enable Transparent Data Encryption in Oracle 12c (12.1 12.2)

$
0
0

1. Add Encryption Wallet in sqlnet.ora Location $ORACLE_HOME/network/admin

[oracle@localhost admin]$ vi sqlnet.ora

ENCRYPTION_WALLET_LOCATION =
(SOURCE =(METHOD = FILE)(METHOD_DATA =
(DIRECTORY = /u01/wallet)))

 

2. Create encryption wallet location

mkdir -p /u01/wallet

3. Create Keystore and Key. And Open the Wallet

SQL*Plus: Release 12.2.0.1.0 Production on Thu May 24 14:36:10 2018

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

 

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 – 64bit Production

SQL> ADMINISTER KEY MANAGEMENT CREATE KEYSTORE ‘/u01/wallet/’ identified by Abc1234$#;

keystore altered.

SQL> ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY Abc1234$#
2 ;

keystore altered.

SQL> ADMINISTER KEY MANAGEMENT SET KEY IDENTIFIED BY Abc1234$# with backup;

keystore altered.

SQL> select * FROM v$encryption_keys;

 

——————————————————————————–
USER_ID KEY_USE KEYSTORE_TYPE
——————————————————————————————————————————– —————- —————– ——————————– ———-
AZeoliwGWU8gv2N8DKilil4AAAAAAAAAAAAAAAAAAAAAAAAAAAAA 24-MAY-18 04.37.19.166968 AM +00:00 24-MAY-18 04.37.19.166972 AM +00:00 SYS 0 SYS 0 TDE SOFTWARE KEYSTORE LOCAL NO orcl 1502594573 orcl 1 4294967295 0 0 00000000000000000000000000000000 orcl 1502594573 orcl 1 4294967295 0 0 00000000000000000000000000000000 0

 

As we can see the encryption keystore is created and open

4. Lets Create Encrypted Tablespace and Check

 

CREATE TABLESPACE TEST_ENCRY
datafile ‘/u01/oradata/orcl/test_encry01.dbf’ size 10M ENCRYPTION USING ‘AES256’ DEFAULT STORAGE(ENCRYPT);

create user vormetric_enc identified by vormetric123 default tablespace TEST_ENCRY;

grant dba to vormetric_enc;

sqlplus vormetric_enc/vormetric123

CREATE TABLE vormetric_enc.Persons (
PersonID int ENCRYPT,
LastName varchar(255) ENCRYPT,
FirstName varchar(255) ENCRYPT,
Address varchar(255) ENCRYPT,
City varchar(255) ENCRYPT
);

 

insert into vormetric_enc.Persons values(‘898899′,’MOHAMMAD’,’SHADAB’,’SURREY HILLS’,’SYDNEY’);

commit;

insert into vormetric_enc.Persons values(‘898899′,’CHRIS’,’MARTIN’,’SURREY HILLS’,’SYDNEY’);

commit;

insert into vormetric_enc.Persons values(‘898899′,’YORKE’,’THOM’,’MANSFIELD’,’MANCHESTER’);

commit;

 

## Test if you can see the data

strings /u01/oradata/orcl/test_encry01.dbf

dp|e
aj”C
W%O*$S
DrCh
O.RY(‘
nUqn
`odj
@`j4
Wl.8)[
mkpo
HyXr
AhT{K
rGp9Ia
(6R<U
ZoQQ

You will only see garbled character, which means your data is now fully encrypted at rest.

You can drop the test tablespace after testing

drop tablespace TEST_ENCRY including contents and datafiles;

 

5. Now just to do a proof of concept to check how easy it is to read data from a datafile (tablespace) if it is not encrypted

create tablespace test datafile ‘/u01/oradata/orcl/test01.dbf’size 10M;

create user vormetric identified by vormetric default tablespace test;

alter user vormetric identified by vormetric123;

grant dba to vormetric;

sqlplus vormetric/vormetric123

CREATE TABLE vormetric.Persons (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);

 

insert into vormetric.Persons values(‘898899′,’MOHAMMAD’,’SHADAB’,’SURREY HILLS’,’SYDNEY’);

commit;

insert into vormetric.Persons values(‘898899′,’CHRIS’,’MARTIN’,’SURREY HILLS’,’SYDNEY’);

commit;

insert into vormetric.Persons values(‘898899′,’YORKE’,’THOM’,’MANSFIELD’,’MANCHESTER’);

commit;

## Test if you can see the data

strings /u01/oradata/orcl/test01.dbf

}|{z
YORCL
|\;:
TEST
AAAAAAAA
V1!
!V1#
YORKE
THOM MANSFIELD
MANCHESTER,
MARTIN
CHRIS
SURREY HILLS
SYDNEY,
MOHAMMAD
SHADAB
SURREY HILLS
SYDNEY

## As you can see data is so clearly visible from the datafile when it is not encrypted

You can  drop the test tablespace after testing

drop tablespace test including contents and datafiles;

 

7. Enable Auto ~Open of wallet so you don’t have to specify the password every-time the database restarts

SQL> SELECT * FROM v$encryption_wallet;

STATUS WALLET_TYPE WALLET_OR FULLY_BAC CON_ID
—————————— ——————– ——— ——— ———-
FILE
/u01/wallet/
OPEN PASSWORD SINGLE NO 0

The wallet is in Password mode which means each time you restart your database you have to specify the key explicitly to open the wallet. We can change this by creating autologin for the wallet, but make you sure you have you encryption key password safely stored somewhere.

SQL> ADMINISTER KEY MANAGEMENT CREATE AUTO_LOGIN KEYSTORE FROM KEYSTORE ‘/u01/wallet/’ IDENTIFIED BY Abc1234$#;

SQL> SELECT * FROM v$encryption_wallet;

STATUS WALLET_TYPE WALLET_OR FULLY_BAC CON_ID
—————————— ——————– ——— ——— ———-
FILE
/u01/wallet/
OPEN AUTOLOGIN SINGLE NO 0

As you can see the Wallet is now AutoLogin

 

The post Enable Transparent Data Encryption in Oracle 12c (12.1 12.2) appeared first on EasyOraDBA.

Upgrade Oracle Apex from 5.1.x to 18.1

$
0
0

Oracle has released the latest version of Apex and keeping in line with their naming convention Apex has jumped from version 5.1.4 to 18.1 . The new version of Apex has many exciting new features, you can read about them all here

Setup :
Apex Version : Oracle Apex 5.1.4
Webserver : ORDS Running on Apache Tomcat 9
DB Version : Oracle 12.2 with January 2018 Patchset

 

1. Download Apex 18.1 from Oracle Website
Link: http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html

 

2. Rename the old apex directory in ORACLE_HOME

cd $ORACLE_HOME
mv apex/ apex_old/

 

3. Go to the new Apex Directory and run the Upgrade

cd apex/

SQL> @apexins.sql apex apex temp /i/

apex – tablespace for apex
apex – tablespace for apex files
temp – temporary tablespace

After a while you will get the below message if you had an earlier version of Oracle Apex

Session altered.

timing for: Phase 1 (Installation)
Elapsed: 00:04:59.21
Phase 2 (Upgrade)

Session altered.

 

— Now beginning upgrade. This will take several minutes.——-‘)

timing for: Phase 2 (Upgrade)
Elapsed: 00:06:10.38
Phase 3 (Switch)
…Upgrading DBMS_REGISTRY

PL/SQL procedure successfully completed.

 

Session altered.

Thank you for installing Oracle Application Express 18.1.0.00.45

Oracle Application Express is installed in the APEX_180100 schema.

The structure of the link to the Application Express administration services is as follows:
http://host:port/pls/apex/apex_admin (Oracle HTTP Server with mod_plsql)
http://host:port/apex/apex_admin (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)
http://host:port/apex/apex_admin (Oracle REST Data Services)

The structure of the link to the Application Express development interface is as follows:
http://host:port/pls/apex (Oracle HTTP Server with mod_plsql)
http://host:port/apex (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)
http://host:port/apex (Oracle REST Data Services)

timing for: Phase 3 (Switch)
Elapsed: 00:00:58.70
timing for: Complete Installation
Elapsed: 00:11:10.83

PL/SQL procedure successfully completed.

 

4. Load Images Directory for Apex.

@apex_epg_config.sql ORACLE_HOME

@apex_epg_config.sql /u01/app/oracle/product/12.2.0/dbhome_1

 

5. Copy images from Apex image directory and Restart your Webserver, in my case I have Tomcat, else you will get below error after you access your Web URL for Apex

“There is a problem with your environment because the Application Express files are not up-to-date! The files for version 5.1.4.00.08 have been loaded, but 18.1.0.00.45 is expected. Please verify that you have copied the images directory to your application server as instructed in the Installation Guide.”

As tomcat user

cd /u01/app/oracle/product/12.2.0/dbhome_1/apex/images/

cp -R * $CATALINA_HOME/webapps/i

sh $CATALINA_HOME/bin/shutdown.sh

sh $CATALINA_HOME/bin/startup.sh

If the error persists, clear all browser cache ,cookies and restart your browser

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=158503212359153&parent=EXTERNAL_SEARCH&sourceId=PROBLEM&id=2342618.1&_afrWindowMode=0&_adf.ctrl-state=beqcsqsc3_4

 

And Oracle Apex is upgraded to the latest version 18.1.0.00.45

Screen Shot 2018-05-28 at 11.17.12 AM

 

 

The post Upgrade Oracle Apex from 5.1.x to 18.1 appeared first on EasyOraDBA.

Viewing all 263 articles
Browse latest View live