Monday, 20 February 2017

Create New Temp Tablespace

CREATE TEMPORARY TABLESPACE PSTEMP TEMPFILE  '/oradata13/JOSHIN/pstemp_02.dbf' SIZE 1g autoextend on maxsize 30g;


ALTER DATABASE DEFAULT TEMPORARY TABLESPACE PSTEMP;



Drop the old temp tablespace

SELECT b.tablespace,b.segfile#,b.segblk#,b.blocks,a.sid,a.serial#,
a.username,a.osuser, a.status
FROM v$session a,v$sort_usage b
WHERE a.saddr = b.session_addr;


TABLESPACE             SEGFILE#    SEGBLK#     BLOCKS        SID    SERIAL# USERNAME             OSUSER                         STATUS
-------------------- ---------- ---------- ---------- ---------- ---------- -------------------- ------------------------------ --------
PSTEMP1                    1026       1664        256        444      26235 SYSADM               svengaka                       INACTIVE
PSTEMP1                    1026       1920        256        496      50372 SYSADM               svengaka                       INACTIVE
PSTEMP1                    1026      17792        256        547      58752 SYSADM               vgadi                          INACTIVE
PSTEMP1                    1026      31616        256        644      46208 SYSADM               svengaka                       INACTIVE


alter system kill session '444,26235';
alter system kill session '496,50372';
alter system kill session '547,58752';
alter system kill session '644,46208';



DROP TABLESPACE PSTEMP1 INCLUDING CONTENTS AND DATAFILES;

SQL> SELECT USERNAME, SESSION_NUM, SESSION_ADDR FROM V$SORT_USAGE;

no rows selected

SQL> col file_name for a45
select tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_temp_files  order by autoextensible;SQL>

TABLESPACE_NAME                FILE_NAME                                     BYTES/1024/1024 MAXBYTES/1024/1024 AUT
------------------------------ --------------------------------------------- --------------- ------------------ ---
PSTEMP1                        /oradata13/JOSHIN/pstemp01.dbf                        31744                  0 NO
PSTEMP                         /oradata13/JOSHIN/pstemp_02.dbf                        1024              30720 YES

SQL> DROP TABLESPACE PSTEMP1 INCLUDING CONTENTS AND DATAFILES;

Tablespace dropped.

SQL>

Change Database name using NID


nid target=/ dbname=JOSHIN


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

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1728053248 bytes
Fixed Size                  2925264 bytes
Variable Size            1073745200 bytes
Database Buffers          637534208 bytes
Redo Buffers               13848576 bytes
Database mounted.

SQL> exit


localhost:/home/oracle/joshi:$ echo $ORACLE_SID
JOSHIN
localhost:/home/oracle/joshi:$ echo $ORACLE_HOME
/instora/product/db12102_TST

localhost:/home/oracle/joshi:$ nid target=/ dbname=JOSHIN

DBNEWID: Release 12.1.0.2.0 - Production on Mon Feb 20 08:24:39 2017

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

Connected to database TEST (DBID=1883339165)

Connected to server version 12.1.0

Control Files in database:
    /oradata05/JOSHIN/control01.ctl
    /oradata06/JOSHIN/control02.ctl

Change database ID and database name TEST to JOSHIN? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 1883339165 to 2634151111
Changing database name from TEST to JOSHIN
    Control File /oradata05/JOSHIN/control01.ctl - modified
    Control File /oradata06/JOSHIN/control02.ctl - modified
    Datafile /oradata06/JOSHIN/system01.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/sysaux01.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/undotbs1.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoeclrg_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eocmlrg_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/audit_dat_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eolarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrwork_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/ptlock_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/ptwork_enc.db - dbid changed, wrote new name
    Datafile /oradata05/JOSHIN/z_archive_dat_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/cularg2_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/cularg3_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/bdapp_enc.db - dbid changed, wrote new name
    Datafile /oradata05/JOSHIN/tllarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hr_32m_dat1_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrapp2_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/psimage_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eocmwrk_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eocuapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoculrg_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eodsapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/pttlrg_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eodslrg_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoecwrk_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoditbl_enc.db - dbid changed, wrote new name
    Datafile /oradata05/JOSHIN/z_bow_sec_tbl_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoeilrg_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eplarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoewlrg_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/epapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoewwrk_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoiuapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoiuwrk_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/erlarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoiulrg_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/pvapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/giapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/psimgr_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/ptprc_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/fsapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/ptamsg_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/erwork_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/gpdeapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/ptaudit_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/ptapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eotplrg_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/ptappe_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hricmailchangelog_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoewapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/tl_32m_dat1_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/audit_idx_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/pttbl_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrapp5_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrapp1_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/coapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoecapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/stlarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/stwork_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/poapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/tlapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/app_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/ewapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/cuaudit_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/py0lrg_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/cularge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/pilarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/diapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/bnlarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/inapp_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/psindex32_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/ptcmstar_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/pylarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrapp4_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/piwork_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/ptrpts_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/waapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/piapp_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/psdefault.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/paapp_enc.db - dbid changed, wrote new name
    Datafile /oradata03/JOSHIN/pi_32m_dat1_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/pi_32m_idx4_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/pi_32m_idx5_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hpapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrapp6_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/pcapp_enc.db - dbid changed, wrote new name
    Datafile /oradata03/JOSHIN/pi_32m_dat4_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/psindex_enc_1.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/cularg1_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrapp3_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/tlwork_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/pttree_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/pyapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/palarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoeiapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/psaudit_enc.db - dbid changed, wrote new name
    Datafile /oradata03/JOSHIN/z_pi_partic_dat_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/htapp_enc.db - dbid changed, wrote new name
    Datafile /oradata05/JOSHIN/z_archive_dat_enc2.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/pywork_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrlarge_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/undotbs2.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/stapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/fgapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/erapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/amapp_enc.db - dbid changed, wrote new name
    Datafile /oradata05/JOSHIN/z_pi_partic_dat_enc_01.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/py_32m_dat1_enc.db - dbid changed, wrote new name
    Datafile /oradata03/JOSHIN/z_pi_partic_idx_enc_01.db - dbid changed, wrote new name
    Datafile /oradata05/JOSHIN/tl_payable_time_dat_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/psindex_idx2_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/bnapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eotpapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/gpapp_enc.db - dbid changed, wrote new name
    Datafile /oradata05/JOSHIN/tl_rptd_elptime_dat_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/psindex_idx3_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/aaapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/pclarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/aalarge_enc.db - dbid changed, wrote new name
    Datafile /oradata05/JOSHIN/training_dat_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/adapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/avapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/ccapp_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/hr_32m_idx1_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/pi_32m_idx1_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/pi_32m_idx2_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/pi_32m_idx3_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/psindex_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/py_32m_idx1_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/tl_32m_idx1_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/tl_payable_time_idx_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/tl_rptd_elptime_idx_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/training_idx_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/z_archive_idx_enc.db - dbid changed, wrote new name
    Datafile /oradata06/JOSHIN/z_pi_partic_idx_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/ptprjwk_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/pi_32m_dat2_enc.db - dbid changed, wrote new name
    Datafile /oradata03/JOSHIN/pi_32m_dat3_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/dtapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eobfapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eocfapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoltapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eoppapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/eopplrg_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/faapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/falarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/fglarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrapp7_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrimage_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrlarg1_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrsapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrsarch_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrslarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/hrswork_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/psimage2_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/psmatvw_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/saapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/sacapp_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/salarge_enc.db - dbid changed, wrote new name
    Datafile /oradata17/JOSHIN/srapp_enc.db - dbid changed, wrote new name
    Datafile /oradata13/TEST/pstemp01.db - dbid changed, wrote new name
    Control File /oradata05/JOSHIN/control01.ctl - dbid changed, wrote new name
    Control File /oradata06/JOSHIN/control02.ctl - dbid changed, wrote new name
    Instance shut down

Database name changed to JOSHIN.
Modify parameter file and generate a new password file before restarting.
Database ID for database JOSHIN changed to 2634151111.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.

localhost:/home/oracle/joshi:$


localhost:/home/oracle/joshi:$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Feb 20 08:26:09 2017

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

Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1728053248 bytes
Fixed Size                  2925264 bytes
Variable Size            1073745200 bytes
Database Buffers          637534208 bytes
Redo Buffers               13848576 bytes
SQL> show parameter db_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      TEST
SQL> alter system set db_name=JOSHIN scope=spfile;

System altered.

SQL> shu immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1728053248 bytes
Fixed Size                  2925264 bytes
Variable Size            1073745200 bytes
Database Buffers          637534208 bytes
Redo Buffers               13848576 bytes

SQL> show parameter db_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      JOSHIN
SQL> alter database mount;

Database altered.

SQL> alter database open RESETLOGS;

Database altered.




SQL> select name,instance_name,open_mode,log_mode,host_name from v$database,v$instance;

NAME      INSTANCE_NAME    OPEN_MODE            LOG_MODE     HOST_NAME
--------- ---------------- -------------------- ------------ ----------------------------------------------------------------
JOSHIN  JOSHIN         READ WRITE           ARCHIVELOG   localhost

Apply JAN 2017 PSU on 12.1.0.2

#############

localhost:/home/oracle/joshi/24732082:$ $ORACLE_HOME/OPatch/opatch lsinv
Oracle Interim Patch Installer version 12.2.0.1.8
Copyright (c) 2017, Oracle Corporation.  All rights reserved.


Oracle Home       : $ORACLE_HOME
Central Inventory : /home/oracle/oraInventory
   from           : $ORACLE_HOME/oraInst.loc
OPatch version    : 12.2.0.1.8
OUI version       : 12.1.0.2.0
Log file location : $ORACLE_HOME/cfgtoollogs/opatch/opatch2017-02-20_07-12-38AM_1.log

Lsinventory Output file location : $ORACLE_HOME/cfgtoollogs/opatch/lsinv/lsinventory2017-02-20_07-12-38AM.txt

--------------------------------------------------------------------------------
Local Machine Information::
Hostname: localhost.joshi.com
ARU platform id: 226
ARU platform description:: Linux x86-64

Installed Top-level Products (1):

Oracle Database 12c                                                  12.1.0.2.0
There are 1 products installed in this Oracle Home.


There are no Interim patches installed in this Oracle Home.


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

OPatch succeeded.

localhost:/home/oracle/joshi/24732082:$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.2.0.1.8
Copyright (c) 2017, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : $ORACLE_HOME
Central Inventory : /home/oracle/oraInventory
   from           : $ORACLE_HOME/oraInst.loc
OPatch version    : 12.2.0.1.8
OUI version       : 12.1.0.2.0
Log file location : $ORACLE_HOME/cfgtoollogs/opatch/opatch2017-02-20_07-13-10AM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

localhost:/home/oracle/joshi/24732082:$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.8
Copyright (c) 2017, Oracle Corporation.  All rights reserved.


Oracle Home       : $ORACLE_HOME
Central Inventory : /home/oracle/oraInventory
   from           : $ORACLE_HOME/oraInst.loc
OPatch version    : 12.2.0.1.8
OUI version       : 12.1.0.2.0
Log file location : $ORACLE_HOME/cfgtoollogs/opatch/opatch2017-02-20_07-14-22AM_1.log

Verifying environment and performing prerequisite checks...
Prerequisite check "CheckActiveFilesAndExecutables" failed.
The details are:


Following executables are active :
$ORACLE_HOME/lib/libclntsh.so.12.1
Prerequisite check "CheckActiveFilesAndExecutables" failed.
The details are:


Following executables are active :
$ORACLE_HOME/lib/libsqlplus.so
UtilSession failed: Prerequisite check "CheckActiveFilesAndExecutables" failed.Prerequisite check "CheckActiveFilesAndExecutables" failed.
Log file location: $ORACLE_HOME/cfgtoollogs/opatch/opatch2017-02-20_07-14-22AM_1.log

OPatch failed with error code 73
localhost:/home/oracle/joshi/24732082:$ ps -ef|grep




localhost:/home/oracle/joshi/24732082:$ fuser $ORACLE_HOME/lib/libclntsh.so.12.1
$ORACLE_HOME/lib/libclntsh.so.12.1: 59886m 71311m
localhost:/home/oracle/joshi/24732082:$ lsof $ORACLE_HOME/lib/libclntsh.so.12.1
COMMAND   PID   USER  FD   TYPE DEVICE SIZE/OFF     NODE NAME
sqlplus 59886 oracle mem    REG 253,22 58795804 14161065 $ORACLE_HOME/lib/libclntsh.so.12.1
sqlplus 71311 oracle mem    REG 253,22 58795804 14161065 $ORACLE_HOME/lib/libclntsh.so.12.1
localhost:/home/oracle/joshi/24732082:$ lsof $ORACLE_HOME/lib/libsqlplus.so
COMMAND   PID   USER  FD   TYPE DEVICE SIZE/OFF     NODE NAME
sqlplus 59886 oracle mem    REG 253,22  1546540 14157272 $ORACLE_HOME/lib/libsqlplus.so
sqlplus 71311 oracle mem    REG 253,22  1546540 14157272 $ORACLE_HOME/lib/libsqlplus.so
localhost:/home/oracle/joshi/24732082:$ ps -ef| grep 59886
oracle    55012   9307  0 07:20 pts/14   00:00:00 grep --color=auto 59886
oracle    59886  52524  0 Feb17 pts/11   00:00:01 sqlplus   as sysdba
localhost:/home/oracle/joshi/24732082:$ ps -ef|grep 71311
oracle    55021   9307  0 07:21 pts/14   00:00:00 grep --color=auto 71311
oracle    71311 128820  0 Feb17 pts/9    00:00:00 sqlplus
localhost:/home/oracle/joshi/24732082:$ kill -9 59886
localhost:/home/oracle/joshi/24732082:$ kill -9 71311
localhost:/home/oracle/joshi/24732082:$ fuser $ORACLE_HOME/lib/libclntsh.so.12.1
localhost:/home/oracle/joshi/24732082:$ fuser $ORACLE_HOME/lib/libsqlplus.so
localhost:/home/oracle/joshi/24732082:$ lsof $ORACLE_HOME/lib/libclntsh.so.12.1
localhost:/home/oracle/joshi/24732082:$ lsof $ORACLE_HOME/lib/libsqlplus.so
localhost:/home/oracle/joshi/24732082:$


###
localhost:/home/oracle/joshi/24732082:$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.8
Copyright (c) 2017, Oracle Corporation.  All rights reserved.


Oracle Home       : $ORACLE_HOME
Central Inventory : /home/oracle/oraInventory
   from           : $ORACLE_HOME/oraInst.loc
OPatch version    : 12.2.0.1.8
OUI version       : 12.1.0.2.0
Log file location : $ORACLE_HOME/cfgtoollogs/opatch/opatch2017-02-20_07-23-36AM_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   19769480  20299023  20831110  21359755  21948354  22291127  23054246  24006101  24732082

Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '$ORACLE_HOME')


Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying sub-patch '19769480' to OH '$ORACLE_HOME'

Patching component oracle.rdbms.deconfig, 12.1.0.2.0...

Patching component oracle.xdk, 12.1.0.2.0...

Patching component oracle.tfa, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/crs/install/tfa_setup" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/19769480/files/crs/install/tfa_setup"

Patching component oracle.rdbms.util, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.xdk.parser.java, 12.1.0.2.0...

Patching component oracle.oraolap, 12.1.0.2.0...

Patching component oracle.xdk.rsf, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/rdbms/mesg/diaus.msb" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/19769480/files/rdbms/mesg/diaus.msb"
Skip copying to "$ORACLE_HOME/rdbms/mesg/diaus.msg" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/19769480/files/rdbms/mesg/diaus.msg"

Patching component oracle.rdbms.rman, 12.1.0.2.0...

Patching component oracle.ldap.rsf, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/lib/libzt12.a" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/19769480/files/lib/libzt12.a"
Skip copying to "$ORACLE_HOME/lib/libccme_asym.so" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/19769480/files/lib/libccme_asym.so"
Skip copying to "$ORACLE_HOME/lib/libccme_ecc.so" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/19769480/files/lib/libccme_ecc.so"
Skip copying to "$ORACLE_HOME/lib/libccme_ecc_accel_fips.so" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/19769480/files/lib/libccme_ecc_accel_fips.so"

Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...
Applying sub-patch '20299023' to OH '$ORACLE_HOME'
ApplySession: Optional component(s) [ oracle.has.crs, 12.1.0.2.0 ]  not present in the Oracle Home or a higher version is found.

Patching component oracle.tfa, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/crs/install/tfa_setup" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/20299023/files/crs/install/tfa_setup"

Patching component oracle.rdbms.deconfig, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.rdbms.rsf.ic, 12.1.0.2.0...

Patching component oracle.ldap.rsf, 12.1.0.2.0...

Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...
Applying sub-patch '20831110' to OH '$ORACLE_HOME'

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.oraolap.dbscripts, 12.1.0.2.0...

Patching component oracle.ldap.rsf, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/lib/libccme_ecc_accel_non_fips.so" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/20831110/files/lib/libccme_ecc_accel_non_fips.so"
Skip copying to "$ORACLE_HOME/lib/libccme_ecc_non_fips.so" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/20831110/files/lib/libccme_ecc_non_fips.so"

Patching component oracle.tfa, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Applying sub-patch '21359755' to OH '$ORACLE_HOME'

Patching component oracle.assistants.server, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.tfa, 12.1.0.2.0...
Applying sub-patch '21948354' to OH '$ORACLE_HOME'

Patching component oracle.rdbms.deconfig, 12.1.0.2.0...

Patching component oracle.xdk, 12.1.0.2.0...

Patching component oracle.tfa, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.xdk.parser.java, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...

Patching component oracle.xdk.rsf, 12.1.0.2.0...
Applying sub-patch '22291127' to OH '$ORACLE_HOME'
ApplySession: Optional component(s) [ oracle.oid.client, 12.1.0.2.0 ]  not present in the Oracle Home or a higher version is found.

Patching component oracle.ldap.rsf, 12.1.0.2.0...

Patching component oracle.ldap.client, 12.1.0.2.0...

Patching component oracle.tfa, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/rdbms/admin/prvtbkrs.plb" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/22291127/files/rdbms/admin/prvtbkrs.plb"
Skip copying to "$ORACLE_HOME/rdbms/admin/dbmsbkrs.sql" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/22291127/files/rdbms/admin/dbmsbkrs.sql"

Patching component oracle.rdbms.rsf, 12.1.0.2.0...

Patching component oracle.oraolap, 12.1.0.2.0...

Patching component oracle.rdbms.rman, 12.1.0.2.0...

Patching component oracle.oraolap.dbscripts, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/rdbms/admin/dbmsaw.sql" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/22291127/files/rdbms/admin/dbmsaw.sql"
Applying sub-patch '23054246' to OH '$ORACLE_HOME'

Patching component oracle.rdbms.dv, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...

Patching component oracle.rdbms.rman, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.ldap.rsf, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/lib/libzt12.a" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/23054246/files/lib/libzt12.a"

Patching component oracle.install.deinstalltool, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/lib/libldapjclnt12.so" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/23054246/files/lib/libldapjclnt12.so"

Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...

Patching component oracle.oracore.rsf, 12.1.0.2.0...

Patching component oracle.ctx, 12.1.0.2.0...

Patching component oracle.xdk, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/bin/xmldiff" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/23054246/files/bin/xmldiff"
Skip copying to "$ORACLE_HOME/bin/xvm" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/23054246/files/bin/xvm"
Skip copying to "$ORACLE_HOME/bin/xmlpatch" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/23054246/files/bin/xmlpatch"
Skip copying to "$ORACLE_HOME/bin/xsl" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/23054246/files/bin/xsl"
Skip copying to "$ORACLE_HOME/bin/xmlcg" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/23054246/files/bin/xmlcg"

Patching component oracle.nlsrtl.rsf, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/bin/lxegen" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/23054246/files/bin/lxegen"
Skip copying to "$ORACLE_HOME/bin/lcsscan" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/23054246/files/bin/lcsscan"
Skip copying to "$ORACLE_HOME/bin/lxchknlb" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/23054246/files/bin/lxchknlb"

Patching component oracle.xdk.parser.java, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/bin/xml" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/23054246/files/bin/xml"

Patching component oracle.ctx.atg, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/lib/libanllexer12.so" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/23054246/files/lib/libanllexer12.so"
Applying sub-patch '24006101' to OH '$ORACLE_HOME'

Patching component oracle.sqlplus, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.network.listener, 12.1.0.2.0...

Patching component oracle.network.rsf, 12.1.0.2.0...

Patching component oracle.rdbms.dv, 12.1.0.2.0...

Patching component oracle.rdbms.rman, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.sqlplus.ic, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Applying sub-patch '24732082' to OH '$ORACLE_HOME'

Patching component oracle.rdbms.install.plugins, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Skip copying to "$ORACLE_HOME/rdbms/mesg/oraus.msb" because it is the same as
the file in incoming patch "/home/oracle/joshi/24732082/24732082/files/rdbms/mesg/oraus.msb"

Patching component oracle.tfa, 12.1.0.2.0...

Patching component oracle.rdbms.rman, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Composite patch 24732082 successfully applied.
Log file location: $ORACLE_HOME/cfgtoollogs/opatch/opatch2017-02-20_07-23-36AM_1.log

OPatch succeeded.

##


localhost:/home/oracle/joshi/24732082:$ sqlplus /nolog

SQL*Plus: Release 12.1.0.2.0 Production on Mon Feb 20 07:31:49 2017

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

SQL> Connect / as sysdba
Connected to an idle instance.
SQL> startup;
ORACLE instance started.

Total System Global Area 2147483648 bytes
Fixed Size                  3712904 bytes
Variable Size            1191184504 bytes
Database Buffers          939524096 bytes
Redo Buffers               13062144 bytes
Database mounted.
Database opened.
SQL>





localhost:$ORACLE_HOME/OPatch:$ ./datapatch -verbose
SQL Patching tool version 12.1.0.2.0 Production on Mon Feb 20 07:34:09 2017
Copyright (c) 2012, 2016, Oracle.  All rights reserved.

Log file for this invocation: /instora/cfgtoollogs/sqlpatch/sqlpatch_61927_2017_02_20_07_34_09/sqlpatch_invocation.log

Connecting to database...OK
Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of SQL patches:
Bundle series PSU:
  ID 170117 in the binary registry and not installed in the SQL registry

Adding patches to installation queue and performing prereq checks...
Installation queue:
  Nothing to roll back
  The following patches will be applied:
    24732082 (DATABASE PATCH SET UPDATE 12.1.0.2.170117)

Installing patches...
Patch installation complete.  Total patches installed: 1

Validating logfiles...
Patch 24732082 apply: WITH ERRORS
  logfile: /instora/cfgtoollogs/sqlpatch/24732082/20904347/24732082_apply_HCM92GLD_2017Feb20_07_34_24.log (errors)
    Error at line 41261: ORA-22308: operation not allowed on evolved type

Please refer to MOS Note 1609718.1 and/or the invocation log
/instora/cfgtoollogs/sqlpatch/sqlpatch_61927_2017_02_20_07_34_09/sqlpatch_invocation.log
for information on how to resolve the above errors.

SQL Patching tool complete on Mon Feb 20 07:34:59 2017



##

SQL> -- UDT and object-view for the 'DVPS_REALM_MEMBERSHIP' homogeneous type,
SQL> -- (xmltag: 'DVPS_REALM_MEMBERSHIP_T', XSLT: rdbms/xml/xsl/kudvrlmm.xsl),
SQL> -- representing realm protections created using ADD_OBJECT_TO_REALM.
SQL> create or replace type dvsys.ku$_dv_realm_member_t as object
  2  (
  3    vers_major    char(1),                             /* UDT major version # */
  4    vers_minor    char(1),                             /* UDT minor version # */
  5    name          varchar2(90),               /* name of database vault realm */
  6    object_owner  varchar2(30),    /* owner of object protected by this realm */
  7    object_name   varchar2(128),    /* name of object protected by this realm */
  8    object_type   varchar2(32)      /* type of object protected by this realm */
  9  )
 10  /
create or replace type dvsys.ku$_dv_realm_member_t as object
*
ERROR at line 1:
ORA-22308: operation not allowed on evolved type


SQL>


##Solution##

SQL> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
JOSHIN  READ WRITE

SQL> !hostname;date
localhost
Mon Feb 20 07:53:44 EST 2017

SQL> drop type dvsys.ku$_dv_realm_member_t validate;

Type dropped.

SQL>


###

localhost:$ORACLE_HOME/OPatch:$ ./datapatch -verbose
SQL Patching tool version 12.1.0.2.0 Production on Mon Feb 20 07:55:37 2017
Copyright (c) 2012, 2016, Oracle.  All rights reserved.

Log file for this invocation: /instora/cfgtoollogs/sqlpatch/sqlpatch_70690_2017_02_20_07_55_37/sqlpatch_invocation.log

Connecting to database...OK
Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of SQL patches:
Bundle series PSU:
  ID 170117 in the binary registry and ID 170117 with errors in the SQL registry

Adding patches to installation queue and performing prereq checks...
Installation queue:
  Nothing to roll back
  The following patches will be applied:
    24732082 (DATABASE PATCH SET UPDATE 12.1.0.2.170117)

Installing patches...
Patch installation complete.  Total patches installed: 1

Validating logfiles...
Patch 24732082 apply: SUCCESS
  logfile: /instora/cfgtoollogs/sqlpatch/24732082/20904347/24732082_apply_HCM92GLD_2017Feb20_07_55_46.log (no errors)
SQL Patching tool complete on Mon Feb 20 07:55:54 2017
localhost:$ORACLE_HOME/OPatch:$


###
SQL> select PATCH_ID,STATUS,DESCRIPTION,BUNDLE_SERIES from dba_registry_sqlpatch;

  PATCH_ID STATUS          DESCRIPTION                                                                                          BUNDLE_SERIES
---------- --------------- ---------------------------------------------------------------------------------------------------- ------------------------------
  24732082 SUCCESS         DATABASE PATCH SET UPDATE 12.1.0.2.170117                                                            PSU

SQL> select name ,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
JOSHIN  READ WRITE

SQL> !hostname;date
localhost
Mon Feb 20 08:01:13 EST 2017

SQL>


SQL> set lines 2000 pages 50
col COMP_NAME for a80
select comp_id, comp_name, status, version from dba_registry; SQL> SQL>

COMP_ID                        COMP_NAME                                                                        STATUS      VERSION
------------------------------ -------------------------------------------------------------------------------- ----------- ------------------------------
CATALOG                        Oracle Database Catalog Views                                                    VALID       12.1.0.2.0
CATPROC                        Oracle Database Packages and Types                                               VALID       12.1.0.2.0
OWM                            Oracle Workspace Manager                                                         VALID       12.1.0.2.0
OLS                            Oracle Label Security                                                            VALID       12.1.0.2.0
XDB                            Oracle XML Database                                                              VALID       12.1.0.2.0
DV                             Oracle Database Vault                                                            VALID       12.1.0.2.0

6 rows selected.

Sunday, 19 February 2017

Session level parallelism setting to run scripts


alter session enable parallel ddl;
alter session force parallel ddl parallel 20;
alter session set db_file_multiblock_read_count = 256;
alter session set "_px_max_granules_per_slave"=3000;
alter session set "_px_index_sampling"=3000;
alter session set "_px_dynamic_sample_size"=3000;
ALTER SESSION ENABLE RESUMABLE TIMEOUT 3600;
alter session set parallel_force_local=TRUE;

Monday, 13 February 2017

DROP Database in RAC

Steps to drop database

srvctl stop database -d TEST

sqlplus / as sysdba

SQL>startup nomount

SQL> alter system set cluster_database=FALSE scope=spfile sid='*';

SQL> shutdown abort;

SQL> startup mount exclusive restrict

SQL>  select logins,parallel from v$instance;

SQL> drop database;



Or

SQL> alter system set cluster_database=FALSE scope=spfile sid='*';

srvctl stop database -d TEST

SQL> startup mount exclusive restrict

SQL>  select logins,parallel from v$instance;

SQL> drop database;


Saturday, 11 February 2017

Manual DB creation

###Command##

CREATE DATABASE JOSHI
USER SYS IDENTIFIED BY abc#1234
USER SYSTEM IDENTIFIED BY 
abc#1234
LOGFILE GROUP 1 ('/u03/oracle/JOSHI/redo01a.log','/u03/oracle/JOSHI/redo01b.log') SIZE 1000M BLOCKSIZE 512,
GROUP 2 ('/u03/oracle/JOSHI/redo02a.log','/u03/oracle/JOSHI/redo02b.log') SIZE 1000M BLOCKSIZE 512,
GROUP 3 ('/u03/oracle/JOSHI/redo03a.log','/u03/oracle/JOSHI/redo03b.log') SIZE 1000M BLOCKSIZE 512
MAXLOGHISTORY 1
MAXLOGFILES 32
MAXLOGMEMBERS 3
MAXDATAFILES 1024
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u03/oracle/JOSHI/system01.dbf' SIZE 800M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SYSAUX DATAFILE '/u03/oracle/JOSHI/sysaux01.dbf' SIZE 550M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
DEFAULT TABLESPACE USERS DATAFILE '/u03/oracle/JOSHI/users01.dbf'SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u03/oracle/JOSHI/temp01.dbf'SIZE 200M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
UNDO TABLESPACE UNDOTBS1 DATAFILE '/u03/oracle/JOSHI/undotbs01.dbf'SIZE 280M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED;

OR

CREATE DATABASE JOSHI
   USER SYS IDENTIFIED BY ora123$
   USER SYSTEM IDENTIFIED BY ora123$
   LOGFILE GROUP 1 ('+DATA','+FLASH') SIZE 1000M BLOCKSIZE 512,
           GROUP 2 ('+DATA','+FLASH') SIZE 1000M BLOCKSIZE 512,
           GROUP 3 ('+DATA','+FLASH') SIZE 1000M BLOCKSIZE 512
   MAXLOGHISTORY 1
   MAXLOGFILES 16
   MAXLOGMEMBERS 3
   MAXDATAFILES 1024
   CHARACTER SET US7ASCII
   NATIONAL CHARACTER SET AL16UTF16
   EXTENT MANAGEMENT LOCAL
   DATAFILE '+DATA'
     SIZE 700M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
   SYSAUX DATAFILE '+DATA'
     SIZE 550M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
   DEFAULT TABLESPACE users
      DATAFILE '+DATA'
      SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
   DEFAULT TEMPORARY TABLESPACE tempts1
      TEMPFILE '+DATA'
      SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
   UNDO TABLESPACE undotbs1
      DATAFILE '+DATA'
      SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED;

             On WINDOWS

oradim -NEW -SID test -STARTMODE MANUAL -PFILE E:\pfiletest.ora

startup nomount;
CREATE DATABASE TEST
USER SYS IDENTIFIED BY sys1234
USER SYSTEM IDENTIFIED BY sys1234
LOGFILE GROUP 1 ('E:\test\REDO01.LOG') SIZE 100M,
GROUP 2 ('E:\test\REDO02.LOG') SIZE 100M,
GROUP 3 ('E:\test\REDO03.LOG') SIZE 100M
MAXLOGHISTORY 1
MAXLOGFILES 32
MAXLOGMEMBERS 3
MAXDATAFILES 1024
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
NLS_LENGTH_SEMANTICS CHAR
EXTENT MANAGEMENT LOCAL
DATAFILE 'E:\TEST\SYSTEM01.DBF' SIZE 800M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SYSAUX DATAFILE 'E:\TEST\SYSAUX01.DBF' SIZE 550M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
DEFAULT TABLESPACE USERS DATAFILE 'E:\TEST\USERS01.DBF'SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE 'E:\TEST\TEMP01.DBF'SIZE 200M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
UNDO TABLESPACE UNDOTBS1 DATAFILE 'E:\TEST\UNDOTBS01.DBF'SIZE 280M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED;

###Once DB created run below###

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql


alter user system account unlock;
connect system/manager;

@?/sqlplus/admin/pupbld.sql

a)catalog.sql =>Creates dictionary tables and views
b)catproc.sql =>Creates PL/SQL procedures,functions and packages necessary.
c)pupbld.sql  =>Creates user profiles.