Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all 1640 articles
Browse latest View live

How to Resolve Error in invoking target ‘agent_nmhs’ of makefile ins_emagent.mk

$
0
0

ins_emagent.mk

During the installation of Oracle 11.2.0.4 on RHEL 7, I faced this error about ins_emagent.mk below:

error in invoking target 'agent nmhs' of make file ins_emagent.mk


In the installation log, we saw a piece of message:
[oracle@test ~]$ vi /u01/app/oraInventory/logs/installActions2016-10-21_05-03-41PM.log
...
INFO: Exception thrown from action: make
Exception Name: MakefileException
Exception String: Error in invoking target 'agent nmhs' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk'. See '/u01/app/oraInventory/logs/installActions2016-10-21_05-03-41PM.log' for details.
Exception Severity: 1
...


Don’t click Abort or Continue, you may find a solution in this post.

By following the error message, you can find the target file that caused this error:
 
[oracle@test ~]$ ls -l $ORACLE_HOME/sysman/lib/ins_emagent.mk
-rw-r--r--. 1 oracle oinstall 5480 Jul 16  2013 /u01/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk


Solution

Now, please edit the file, it’s around line #176, you should add an option -lnnz11 to this command:
$(MK_EMAGENT_NMECTL) -lnnz11
[oracle@test ~]$ vi /u01/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk
...
    176         #$(MK_EMAGENT_NMECTL)
    177         $(MK_EMAGENT_NMECTL) -lnnz11

 

In the above, I commented out the original line 176 and add a line underneath. Just like I said, I added an option to it. After that, you can save the file, and then click Retry, it will solve the problem this time.

Article 0

$
0
0

Installing and Configuring ASMLIb on Oracle Linux 7


Differences to start ASMLib on OEL 6 and 7.


Quick guide to install (done on OEL 7), start and configure:

1. Install the ASMLib kernel module package as root using the following command:

         yum install kmod-oracleasm

2. Install the ASMLib library package and utilities package

         yum install oracleasm-support oracleasmlib oracleasm-`uname -r`
It’s possible some package to not found. For example:

No package oracleasmlib available.
So, you can download rpm libs from here and install via rpm:

[oracle@standalone oracle]$ sudo rpm -Uvh ~/oracleasmlib-2.0.12-1.el6.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
1:oracleasmlib-2.0.12-1.el6        ################################# [100%]

Ok, now, lets configure/start services:

[oracle@standalone ~]$ sudo /etc/init.d/oracleasm configure
    Nothing happen

=================================================================
ISSUE 1: -
[oracle@standalone ~]$ sudo /etc/init.d/oracleasm start
Starting oracleasm (via systemctl):  Job for oracleasm.service failed because the control process exited with error code. See "systemctl status oracleasm.service" and "journalctl -xe" for details.
[FAILED]
                                                       (OR)

ISSUE 2: -
[oracle@standalone init.d]$ sudo oracleasm listdisks
[oracle@standalone init.d]$ sudo oracleasm createdisk ORA_DATA /dev/sde1
oracleasm module not loaded or /dev/oracleasm not mounted.
================================================================

[oracle@standalone ~]$ sudo oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Configuring "oracleasm" to use device physical block size
Mounting ASMlib driver filesystem: /dev/oracleasm


[oracle@standalone ~]$ sudo oracleasm configure
ORACLEASM_UID=
ORACLEASM_GID=
ORACLEASM_SCANBOOT=true
ORACLEASM_SCANORDER=""
ORACLEASM_SCANEXCLUDE=""
ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"

[oracle@standalone ~]$ sudo oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting  without typing an
answer will keep that current value.  Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: oinstall
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done


[oracle@standalone ~]$ sudo oracleasm configure
ORACLEASM_UID=grid
ORACLEASM_GID=oinstall
ORACLEASM_SCANBOOT=true
ORACLEASM_SCANORDER=""
ORACLEASM_SCANEXCLUDE=""
ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"
[oracle@standalone ~]$ sudo oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes

To add a disk, the same process can be followed on earlier versions:

[oracle@standalone ~]$ sudo oracleasm createdisk ORA_DATA /dev/sde1
Writing disk header: done
Instantiating disk: done
[oracle@standalone ~]$ sudo oracleasm listdisks
ORA_DATA 

ORA-04030: out of process memory when trying to allocate 4582743 bytes (kxs-heap-w,krvxlogact) in oracle Goldengate

$
0
0
ORA-04030: out of process memory when trying to allocate 4582743 bytes (kxs-heap-w,krvxlogact) in oracle Goldengate

In such case our extract process will not capture any data from database using either archive log or redolog.

REASON: Archived log files not getting purged properly after being used by the GoldenGate or Streams.

Then try to start capture process using force checkpoint option.

exec dbms_capture_adm.set_parameter('<capture_name>','_CHECKPOINT_FORCE','Y');

Then get the applied scn and required scn from database level using below query.

select capture_name, status, to_char(APPLIED_SCN), to_char(REQUIRED_CHECKPOINT_SCN) from dba_capture;

And alter the capture process using applied and required scn, Then start the extract process.

conn / as sysdba
BEGIN
DBMS_CAPTURE_ADM.ALTER_CAPTURE(
capture_name => '<capture_name>',
first_scn => &SCN );
END;
/

Replicat Abends With OCI Error ORA-01843: Not A Valid Month

$
0
0
Replicat Abends With OCI Error ORA-01843: Not A Valid Month

POSSIBLE REASON: Trying to insert data column with invalid date format.

Add below parameter into replicat param file.

ALLOWDUPTARGETMAP.


MAP GGTEST.DEMO1 TARGET GGTEST.DEMO1, FILTER (@STREQ (@GETENV ("GGHEADER", "OPTYPE"), "INSERT") OR (@STREQ (@GETENV ("GGHEADER", "OPTYPE"), "DELETE")));

REPERROR (-1843, DISCARD)


MAP GGTEST.DEMO1 TARGET GGTEST.DEMO1, FILTER (@STREQ (@GETENV ("GGHEADER", "OPTYPE"), "PK UPDATE")
MAP GGTEST.DEMO1 TARGET GGTEST.DEMO1, FILTER (@STREQ (@GETENV ("GGHEADER", "OPTYPE"), "SQL COMPUPDATE")
MAP GGTEST.DEMO1 TARGET GGTEST.DEMO1, FILTER (@STREQ (@GETENV ("GGHEADER", "OPTYPE"), "UPDATE")));

OGG-01154 SQL error 100 mapping GGTEST.DEMO1 to GGTEST.DEMO1_LATEST_MONTH No data found.

$
0
0
Some columns missing on Target database tables after Replicat completes

OGG-01154 SQL error 100 mapping GGTEST.DEMO1 to GGTEST.DEMO1_LATEST_MONTH No data found.


DO A COMPLETE RESYNC

Check the oldest open transaction on source using below query.

select min(start_time) from gv$transaction ; (RAC)
select min(start_time) from gv$transaction ; (STANDALONE)

 alter extract , begin

  this way extract is position prior to the oldest open transaction so that we dont miss anything
 
 stop the replicat on target side.

Start the extract

Take a export backup for that affected table on source using FLASHBACK_SCN option..use the current scn of the source db for the scn.

And perform  the import on target

Start the replicat like ..ggsci> start rep aftercsn

 the trails have the SCN of source..replicat would read through those and start exactly from a scn higher than the export scn so that there is no data loss/ gap

Article 1

$
0
0
Permanently change the host name of an Oracle Cloud Infrastructure (OCI) compute instance

1: Edit /etc/sysconfig/network
change the parameter value for "hostname"
example:
# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=instance-ol6 <--------- change here

2: In the file /etc/oci-hostname.conf change the value of PRESERVE_HOSTINFO to 2.
/etc/oci-hostname.conf
PRESERVE_HOSTINFO=2

This change will be persistent across reboots

For Oracle Linux 7

1: Update the /etc/hostname file with below command.
    hostnamectl set-hostname <new name>

2: Edit the oci configuration file for hostnames as given below to update the needed value to 2.
    vi /etc/oci-hostname.conf
    PRESERVE_HOSTINFO=2
    save the changes.

3: Edit the FQDN from OCI console GUI
go to compute instances
--> select the instance
--> scroll down
--> at the left bottom corner select attached VNIC under resources
--> edit appropriate VNIC
--> change hostname to update FQDN
--> update VNIC

4: Reboot the instance

5: Check the hostname with hostname command.

Article 0

$
0
0
Error while running adpreclone R-12.1.3:-

RC-30007: Stage area /ebsdb1/ebstest/db/tech_st/11.1.0/appsutil/clone/dbts

Solution:-

cd /ebsdb1/ebstest/db/tech_st/11.1.0/appsutil/clone

mv dbts dbts_bkp

mkdir dbts

Run perl adpreclone.pl dbTire



Article 0

$
0
0
Exporting and importing Oracle AWR STATSPACK snapshots:-

Exporting and importing Oracle AWR STATSPACK snapshots:-

To extract AWR data:
At the SQL prompt, enter:
@$ORACLE_HOME/rdbms/admin/awrext.sql
A list of the databases in the AWR schema is displayed.

Specify the database from which the AWR data will be extracted:
Enter value for db_id: 1377863381
In this example, the database with the database identifier of 1377863381 is selected.

Specify the number of days for which you want to list snapshot Ids.
Enter value for num_days: 2
A list of existing snapshots for the specified time range is displayed. In this example, snapshots captured in the last 2 days are displayed.

Define the range of snapshots for which AWR data will be extracted by specifying a beginning and ending snapshot Id:
Enter value for begin_snap: 30
Enter value for end_snap: 40
In this example, the snapshot with a snapshot Id of 30 is selected as the beginning snapshot, and the snapshot with a snapshot Id of 40 is selected as the ending snapshot.

A list of directory objects is displayed.
Specify the directory object pointing to the directory where the export dump file will be stored:

Enter value for directory_name: DATA_PUMP_DIR
In this example, the directory object DATA_PUMP_DIR is selected.

Specify the prefix for name of the export dump file (the .dmp suffix will be automatically appended):
Enter value for file_name: awrdata_30_40
In this example, an export dump file named awrdata_30_40 will be created in the directory corresponding to the directory object you specified:

Dump file set for SYS.SYS_EXPORT_TABLE_01 is:
AWRDATA_30_40.DMP
Job "SYS"."SYS_EXPORT_TABLE_01" successfully completed at 08:58:20
Depending on the amount of AWR data that needs to be extracted, the AWR extract operation may take a while to complete. Once the dump file is created, you can use Data Pump to transport the file to another system.

Loading AWR Data:-

SCP the dumpfile to the server which we need to load the AWR data.

At the SQL prompt, enter:

sql>@$ORACLE_HOME/rdbms/admin/awrload.sql

Specify the directory object pointing to the directory where the export dump file is located:
Enter value for directory_name: DATA_PUMP_DIR
Specify the prefix for name of the export dump file (the .dmp suffix will be automatically appended):
Enter value for file_name: awrdata_30_40
Specify the name of the staging schema where the AWR data will be loaded:
Enter value for schema_name: AWR_STAGE
Specify the default tablespace for the staging schema:
Enter value for default_tablespace: SYSAUX
Specify the temporary tablespace for the staging schema:
Enter value for temporary_tablespace: TEMP
A staging schema named AWR_STAGE will be created where the AWR data will be loaded. After the AWR data is loaded into the AWR_STAGE schema, the data will be transferred into the AWR tables in the SYS schema:
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Completed 113 CONSTRAINT objects in 11 seconds

Internal Concurrent Manager status cannot be determined

$
0
0
ISSUE:

Not able to determine the status of Internal Concurrent Manager using the script 'adcmctl.sh'.

Installation of E-Business Suite R12 on Oracle Linux 5.6, all post-install steps were completed successfully, no errors. Application startup was fine, ICM was also working and requests were being served properly.  Attempting to check the status of Internal Concurrent Manager using the script 'adcmctl.sh', responded with error.

Running the following:
./adcmctl status apps/<appspwd>

'Internal Concurrent Manager status cannot be determined'
Running the following:
$FND_TOP/bin/FNDSVCRG STATUS
received:

'Internal Concurrent Manager status could not be determined'


FINDINGS:

This issue is documented in the following bug:
Bug 12353506 - ADCMCTL.SH SCRIPT IS UNABLE TO DETERMINE THE ICM STATUS

Modify a minor parameter used to execute a sql statement in afpsrg.o which is a main routine for an executable, FNDSVCRG. It's been like this for many years but apparently, database 11g has more stringent checking on the parameter. Plus, using adcmctl.sh with "status" as a parameter is a rarely used functionality.
Parameters to afuexec(use_curs, 1, 0, NOHOLD), parameter will need to be 1, 1 rather than 1, 0.

Files modified or created
  fnd src/process afpsrg.oc 120.0.12010000.2
  Fix summary: bug 12353506 - changed a parameter to afuexec to avoid error
  when FNDSVCRG is called with STATUS.
  Forced checkin of dual maintained file from revision 115.10


SOLUTION:

For 12.1 test the following steps in a development instance and then migrate accordingly:

1. Download and review the readme of Patch 12410716

2. Apply the patch in a test instance and verify the fix prior to application to other instances.


Note:For apps 12.0 the following patch will fix the issue:
Patch 14093847:R12.FND.A

The patch provides: afpsrg.oc: 120.0.12000000.4 :
Patch detail:
1OFF:12410716:FNDSVCRG STATUS COULD NOT BE DETERMINED AFTER RHEL5



For 12.2 test the following steps in a development instance and then migrate accordingly:

$FND_TOP/bin/FNDSVCRG STATUS
Internal Concurrent Manager status could not be determined



1. Check the value for $GWYUID, and confirm it is either not set or invalid.



2. SQL> select USERNAME,ACCOUNT_STATUS,PROFILE from dba_users where USERNAME like 'APP%'

USERNAME ACCOUNT_STATUS
APPLSYSPUB EXPIRED(GRACE)



3. Ensure APPLSYSPUB status is OPEN. After resetting the password of APPLSYSPUB , you should able to connect using sqlplus.

REFERENCE:

Adcmctl.Sh Script Is Unable To Determine The ICM Status (Doc ID 1320217.1)

How To Submit A Concurrent Request Using CONCSUB Syntax

$
0
0
REQUIREMENT:

How to submit a concurrent program using the CONCSUB utility from the operating system.

SOLUTION:

One can submit a concurrent request to run any concurrent program by running the CONCSUB program with the following syntax:


CONCSUB <APPS username>/<APPS password> \
<responsibility application short name> \
<responsibility name> \
<username> \
[WAIT=N|Y|<n seconds>] \
CONCURRENT \
<program application short name> \
<program name> \
[PROGRAM_NAME=<description>] \
LANGUAGE - R12 onwards only \
TERRITORY - R12 onwards only
[ORG_ID=<#>] - R12 onwards only
[REPEAT_TIME=<resubmission time>] \
[REPEAT_INTERVAL= <number>] \
[REPEAT_INTERVAL_UNIT=< resubmission unit>] \
[REPEAT_INTERVAL_TYPE=< resubmission type>] \
[REPEAT_END=<resubmission end date and time>] \
[START=<date>] \
[IMPLICIT=< type of concurrent request> \
[<parameter 1> ... <parameter n>]

For parameters that follow the CONCURRENT parameter and include spaces, enclose the parameter argument in double quotes, then again in single quotes. Oracle Application Object Library requires this syntax because it parses the argument string twice.

For example, to pass this argument to a program:

08JUN96 23:55:00
pass this argument through CONCSUB:

'"08JUN96 23:55:00"'


Note: If the line continuation character is not supported then the CONCSUB command should be submitted as one continuous line.


Parameters

The following entries explain the required and optional parameters for submitting a concurrent program with CONCSUB. Default values are listed to the right.


<username/password> Required. The ORACLE username and password that provides access to the data that the program uses.

<responsibility application short name> Required. The application short name of the responsibility whose concurrent processing options to be used.

<responsibility name> Required. The name of the responsibility. If the name of the responsibility includes spaces, enclose that name in double quotes.

<username> Required. The uppercase username of the application user whose concurrent processing options to use.

<WAIT> Optional. A flag that indicates whether to wait for the submitted request to complete. If one leaves this parameter out, the default value of N makes CONCSUB return to the operating system prompt without waiting for the request to complete.
Set WAIT=Y to have CONCSUB check the request status every 60 seconds and returns to the operating system prompt when the request is completed. One can also enter an integer value for a number of seconds, as in WAIT=30, for CONCSUB to check for request completion every <number> seconds.

Attention: Using WAIT=Y or WAIT=<number> requires that the request completes before CONCSUB returns to the operating system. If the concurrent manager is down, the CONCSUB process waits indefinitely until the concurrent manager is started and the request completes.

<CONCURRENT> Required. A flag that separates the program specific parameters from the operating system parameters.

<program application short name> Required. The application short name of the concurrent program.

<program name> Required. The uppercase name of the program. It must be the short name that was enter in the Concurrent Programs window when defining a concurrent program.

<PROGRAM_NAME> Optional. A descriptive name for your program. The program field on the View Requests form displays this as the user friendly program name. The concurrent program short name passed to CONCSUB is often hard for end users to understand, so the PROGRAM_NAME parameter allows one to pass a more easily remembered name for a concurrent program. If one does not specify a PROGRAM_NAME, the View Requests form displays the user friendly program name specified in the Concurrent Programs window.
One may also use the PROGRAM_NAME parameter to indicate the batch that your request processes for programs that process a set of data, where there could be several requests for a given program that are active at the same time.

<ORG_ID> Optional. Introduced in R12, set to org id required for the report to be run with.

<REPEAT TIME> Optional. The time of day to resubmit the request.  The format for the time is HH24:MI or HH24:MI:SS. For example, REPEAT_TIME=14:30 resubmits the request daily at 2:30 p.m.

Attention: Do not use REPEAT_TIME with other resubmission parameters except for the optional parameters REPEAT_END and START.

<REPEAT_INTERVAL> Optional. The interval between resubmission (a positive integer or real number). Use this parameter along with REPEAT_INTERVAL_UNIT to specify the time between resubmissions.

<REPEAT_INTERVAL_UNIT> Optional. The unit of time used for the interval between resubmissions. The available units are MINUTES, HOURS, DAYS or MONTHS. Use this parameter along with REPEAT_INTERVAL to specify the time between resubmissions. For example, setting REPEAT_INTERVAL=12 and REPEAT_INTERVAL_UNIT=HOURS resubmits the request every twelve hours. The default value is DAYS.

Attention: Do not use REPEAT_INTERVAL and REPEAT_INTERVAL_UNIT with REPEAT_TIME.

<REPEAT_INTERVAL_TYPE> Optional. Whether to time the resubmission interval from the requested start time of the request or from its completion. Set this parameter either to START or END. The default value is START.

Attention: Use REPEAT_INTERVAL_TYPE only if one uses REPEAT_INTERVAL.

<REPEAT_END> Optional. The date and time to stop resubmitting the concurrent request. Use one of the following for the format of the end date:

DDMONRR HH24:MI:SS (as in 07“APR02 18:32:05€™)
or
DDMONRRRR HH24:MI:SS (as in 07€“APR2002 18:32:05€™)
Note that because this date format includes a space, one must enclose the date in double quotation marks and single quotation marks. One can also specify just the date:
DDMONRR
or
DDMONRRRR

<LANGUAGE> Optional. The NLS language for the request. (LANGUAGE=SIMPLIFIED CHINESE \)

<TERRITORY> Optional. The NLS territory for the request. (TERRITORY=CHINA \)

<START> Optional. A start date and time for the program in this format:
DDMONRR HH24:MI:SS (as in 07€“APR02 18:32:05€™)
Because this date format includes a space, one must enclose the date in double quotation marks and single quotation marks. If one does not specify a start time, the program submits immediately and is processed by the next available concurrent manager. The default value is the current time.

<IMPLICIT> Optional. Whether to show this concurrent request on the View Requests form. Specify NO, YES, ERROR or WARNING. The value IMPLICIT=NO allows the request to appear on the View Request form. The default value is NO.
The value IMPLICIT=YES means that only the System Administrators privileged View Concurrent Requests form displays this request. Use this value if the request is not interesting to the user.
Specify IMPLICIT=ERROR or IMPLICIT=WARNING, respectively, if one wants the request to appear only if it fails or completes with warnings.

<REPEAT_DAYS> Optional. The number of days after which to repeat the concurrent request, calculated from the last requested start date. The number can be a positive integer or real number. For example,
REPEAT_DAYS=1.5 resubmits the request every 36 hours.

Attention: Do not use REPEAT_DAYS with other re-submission parameters except for the optional parameters REPEAT_END and START.
Suggestion: REPEAT_DAYS will become obsolete in a future release. One may therefore want to use REPEAT_INTERVAL, REPEAT_INTERVAL_TYPE and REPEAT_INTERVAL_UNIT instead of REPEAT_DAYS.

<parameter 1> ...<parameter n> Optional. The program specific parameters. If a parameter includes spaces, enclose that parameter in double quotes, then in single quotes. If a parameter contains a double quotation mark as part of the argument, precede that mark with a backslash [\].

Please note that the program specific parameters must be explicitly passed to CONCSUB,  any default values that may be used when the program is submitted via the normal screens (ie Standard Report Submission or SRS) will not be used by CONCSUB.

REFERENCE:

How To Submit A Concurrent Request Using CONCSUB Syntax (Doc ID 457519.1)

Unable to find an Output Post Processor service to post-process request xxxxx. Check that the Output Post Processor service is running

$
0
0
ISSUE:

'Unable to find an Output Post Processor service to post-process request xxxxx.

Check that the Output Post Processor service is running'


FINDINGS:

Incorrect data is present in the OPP queue table AQ$FND_CP_GSM_OPP_AQTBL_S, which occurs when the concurrent managers are not shutdown correctly.

A quick sql query shows orphaned OPP subscribers in APPLSYS.AQ$FND_CP_GSM_OPP_AQTBL_S, causing the select_random_subscriber routine to pick a non-running process.

SOLUTION:

To resolve the issue test the following steps in a development instance and then migrate accordingly:

1. Find the active processes for OPP:

SELECT fcp.concurrent_process_id
FROM fnd_concurrent_queues fcq, fnd_concurrent_processes fcp
WHERE concurrent_queue_name = 'FNDCPOPP'
AND fcq.concurrent_queue_id = fcp.concurrent_queue_id
AND fcq.application_id = fcp.queue_application_id
AND fcp.process_status_code = 'A';
Output example:

CONCURRENT_PROCESS_ID
---------------------
93557
93558

2. Find the OPP subscribers:

select name from APPLSYS.AQ$FND_CP_GSM_OPP_AQTBL_S;

The name in the table is the concurrent_process_id prefixed with 'OPP'.
The output should normally correspond to the output of first query: have the same number of records and have as name the concurrent_process_id of the running OPP processes prefixed by OPP

Output example:

NAME
------------------------------
OPP93558
OPP93557
OPP88933
OPP92625

3. If there are extra subscribers which are left from previous runs of OPP processes, unsubscribe them via the following command:

  exec fnd_cp_opp_ipc.unsubscribe('<concurrent_process_id>');
 Example:

  exec fnd_cp_opp_ipc.unsubscribe('88933');

  exec fnd_cp_opp_ipc.unsubscribe('92625');

4. Retest some concurrent requests and confirm the post processing actions now complete successfully.


REFERENCE:

R12 E-Business Suite Output Post Processor (OPP) Fails To Pick Up Concurrent Requests With Error 'Unable to find an Output Post Processor service to post-process request nnnnn' (Doc ID 2215371.1)

Steps to create Oracle Wallet

$
0
0
Please find the below steps

1. Create wallet directory 

mkdir -p /home/scripts/PROMO_CHANGE/WALLET

2. Setup Wallet

orapki wallet create -wallet /home/scripts/PROMO_CHANGE/WALLET -pwd wallet_pwd -auto_login


3. Download certificate (Check the port number which is opened to that particular host)

openssl s_client -servername abc.domain.int -connect abc.domain.int:443 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'>/tmp/certificate12.cer

4. Add certificate key to the wallet
orapki wallet add -wallet /home/scripts/PROMO_CHANGE/WALLET -trusted_cert -cert “/tmp/certificate12.cer” -pwd wallet_pwd

5. Update $TNS_ADMIN/sqlnet.ora like below.


SQLNET.WALLET_OVERRIDE = TRUE
WALLET_LOCATION=(
  SOURCE=(METHOD=FILE)
  (METHOD_DATA=(DIRECTORY=/home/scripts/PROMO_CHANGE/WALLET))
)

Bounce or Reload the listener.


6. Test the certificate 

orapki wallet display -wallet "/home/scripts/PROMO_CHANGE/WALLET " -pwd wallet_pwd


Check Existing ACL’s information :
----------------------------------------------

set lines 160
col HOST format a40
col ACL format a40
col ACLID format a40
select * from DBA_NETWORK_ACLS;


Check Existing ACL’s privilege information :
--------------------------------------------------------

col ACL format a40
col PRINCIPAL format a40
set lines 160
select acl , principal , privilege , is_grant from DBA_NETWORK_ACL_PRIVILEGES;


Please follow the below to create,add,assign acl for a particular user.


begin
dbms_network_acl_admin.create_acl (
acl => 'utl_http.xml',
description => 'HTTP Access',
principal => 'SYS',
is_grant => TRUE,
privilege => 'connect',
start_date => null,
end_date => null
);
commit;
end;
/

begin
dbms_network_acl_admin.add_privilege (
acl => 'utl_http.xml',
principal => 'SYS',
is_grant => TRUE,
privilege => 'resolve',
start_date => null,
end_date => null
);
commit;
end;
/


begin
dbms_network_acl_admin.assign_acl (
acl => 'utl_http.xml',
host => '*',
lower_port => null,
upper_port => null
);
commit;
end;
/

grant execute on utl_http to SYS;

Script to connect multiple databases for changes

$
0
0
Please follow the steps below.

Suppose if you are monitoring all databases from a common server. Then use the below script to do some changes in all databases at one time.

USAGE:
----------

This script is to lock the account & profile changes for all the databases from monitor server for an user or as per the need. Instead of logging into all databases 1 by 1.

Like wise we can change the content as per our need which is marked in yellow. Pass the database name in /u01/MONITOR/changes/db_mbp.parms.

[oracle@monitor changes]$ cat xyz.sh

ORACLE_HOME=/oracle/app/product/11.2.0.3/client_1; export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH; export PATH
cat /u01/MONITOR/changes/db_mbp.parms | while read line
do
database=`echo $line | awk '{print $1}'`
echo $database
sqlplus -s borra/pwd@$database << EOF >> /home/oracle/borra/list.txt
set verify off
set feedback off
set lines 150
set pages 0
set heading off
set space 0
break on name
alter user borra account lock;
alter profile default limit PASSWORD_LIFE_TIME UNLIMITED;
exit
EOF
done

Article 1

$
0
0
                                          Script to list the aduit configuration in EBS 



This script will list areas where auditing configuration is different from the
E-Business Suite guidance.

Query:

column "Internal Name" format A23
column "Profile Name" format A30
column "Profile Level" format a15
column "Profile Context" format a25
column "Value" format A10 wrap
column "Last Updated" format a12


select p.profile_option_name "Internal name",
n.user_profile_option_name "Profile name",
to_char(v.last_update_date,'DD-MON-RR') "Last Updated",
decode(v.level_id,
10001, 'Site',
10002, 'Application',
10003, 'Responsibility',
10004, 'User',
10005, 'Server',
10007, 'SERVRESP',
'UnDef') "Profile Level",
decode(to_char(v.level_id),
'10001', '',
'10002', app.application_short_name,
'10003', rsp.responsibility_key,
'10005', svr.node_name,
'10006', org.name,
'10004', usr.user_name,
'10007', 'Serv/resp',
'UnDef') "Profile Context",
v.profile_option_value "Value",
decode(p.profile_option_name,
'AFLOG_ENABLED','Debug Logging should be On at Site level',
'AFLOG_LEVEL','Logging should be set to at least Unexpected at Site level',
'SIGNONAUDIT:LEVEL','Sign-on audit should be set to Forms at Site level',
'') "Recommendation"
from fnd_profile_options p,
fnd_profile_option_values v,
fnd_profile_options_tl n,
fnd_user usr,
fnd_application app,
fnd_responsibility rsp,
fnd_nodes svr,
hr_operating_units org
where p.profile_option_id = v.profile_option_id (+)
and p.profile_option_name = n.profile_option_name
and n.language = 'US'
and ((p.profile_option_name = 'AFLOG_ENABLED' and v.level_id=10001 and v.profile_option_value !='Y') -- Recommend that logging is set to Unexpected at Site level
     or (p.profile_option_name = 'AFLOG_LEVEL' and v.level_id=10001 and v.profile_option_value > 6) -- Recommend that logging is set to at least Unexpected at Site level
or (p.profile_option_name = 'SIGNONAUDIT:LEVEL' and v.level_id=10001 and v.profile_option_value !='D') -- Recommend that sign-on audit be set to Forms at Site level
)
and usr.user_id (+) = v.level_value
and rsp.application_id (+) = v.level_value_application_id
and rsp.responsibility_id (+) = v.level_value
and app.application_id (+) = v.level_value
and svr.node_id (+) = v.level_value
and org.organization_id (+) = v.level_value
order by p.profile_option_name, "Profile Level";

REM ----------------------------------------------------------------------------
REM Check DB audit settings (traditional auditing)
REM ----------------------------------------------------------------------------

REM Check Audit Trail setting

select 'audit_trail be set to DB or FILE'"Recommendation"
from v$parameter
where name ='audit_trail' and value='NONE';     

REM Check Audit Sys Operations setting

select 'audit_sys_operations should be set to TRUE'"Recommendation"
from v$parameter
where name ='audit_sys_operations' and value != 'TRUE';     

Article 0

$
0
0
                     ORA-01092 ORA-00604 ORA-04024 While trying to Open the database


Problem:

Error occurred while opening the database in read only/read write,

 ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00604: error occurred at recursive SQL level 1
ORA-04024: self-deadlock detected while trying to mutex pin cursor 0x7C92EC118
Process ID: 14520
Session ID: 1423 Serial number: 25044

Cause: 

The issue is caused due to Unpublished Bug 21799609 - ORA-04024 DEADLOCK ON STARTUP ON SYS.ECOL$ ON LOAD
HISTOGRAMS which has been closed as duplicate of BUG 19469538 - LOADING OF DATA IN ECOL$ TABLE IS NONOPTIMAL
FOR QUERIES

Database was upgraded from 11.2.0.4 to 12.1.0.2

Fixed Version : 12.2.0.1
Solution:

Option 1
In the database, implement the workaround from Bug 21799609 :

SQL> alter system set "_fix_control"='9550277:ON';
Once set try to Open the database

SQL>alter database open read only;
Or

SQL>alter database open ;

Option 2

Check for availability of one off Patch using Patch 19469538 for your Platform and apply the permanent fix for this issue




Article 2

$
0
0
                     RMAN: ORA-7445: [pfrsgr()+24]/ORA-600: [pfrsfm: heap mismatch #7]


Problem:

RMAN: ORA-7445: [pfrsgr()+24]/ORA-600: [pfrsfm: heap mismatch #7]
after installing 12.1.0.2.190716 (Jul 2019) Database Proactive Bundle Patch on Solaris SPARC

Platform


Error Cause:

Process May Dump (ORA-7445) / Abend / Abort
Internal Error May Occur (ORA-600)
RMAN-12005
ORA-600 [pfrsfm: heap mismatch #7]
ORA-600 [psdegsh: pop_top_level_call: pe]
Dump in or under pfrsgr

RMAN (Recovery Manager)


Workaround:

It is required to install this one-off on top of Patch 29699255 to have this problem fixed.

Please cross-check with support before implementing on your UAT/PROD environments. 

Article 1

$
0
0

                    Change wallet password using orapki/OWM



To change the password for a wallet:

Start Oracle Wallet Manager.

(UNIX) At the command line, enter the following command:
owm

(Windows) Select Start, Programs, Oracle-HOME_NAME, Integrated Management Tools, Wallet Manager

If the wallet is closed, then open it by selecting Open from the Wallet menu. When prompted, select the wallet directory location, and then enter your wallet password.

From the Wallet menu, select Change Password.

The Change Wallet Password dialog box appears.

Enter the following information:

Old Wallet Password: Enter the current wallet password.

New Wallet Password and Confirm Wallet Password: Enter the new password.

Click OK.

A message at the bottom of the window confirms that the password was successfully changed.



Change wallet password using orapki


[oracle@vmxdb01 wallet]$ ls -ltr
total 12
-rw-------. 1 oracle oinstall 1838 May 25 20:21 ewallet.p12
-rw-------. 1 oracle oinstall 1915 May 25 20:21 cwallet.sso
-rw-r--r--. 1 oracle oinstall    9 May 25 20:22 password.txt

[oracle@vmxdb01 wallet]$ orapki wallet change_pwd -wallet  $ORACLE_HOME/wallet 
Oracle PKI Tool : Version 11.2.0.2.0 - Production
Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
 
Enter wallet password:   Easy2rem
    
New password:
Enter wallet password:   Never4get


Article 0

$
0
0
                                      Query to know about the DB information.


This script will give the information about the Database Parameter Settings,PARALLELISM Settings ,Tables with NOLOGGING attribute,List of Objects by Schema Owner Primarily for informational purposes,Tablespace Info,Database size Info,Redo Log Files and Sizing,Redolog Switch Rate by Date and Hour,Tablespaces with Transparent Data Encryption,Listing of Index Organized Tables etc..

Query:

-- Script Name:         Cust_DBInfo_v921.sql

set termout on
set verify off;
set linesize 300;
set pagesize 1000;
set trimspool on
define user_exclusion="('SYS','SYSTEM','MDSYS','ORDSYS','EXFSYS','DMSYS','WMSYS','CTXSYS','SYSMAN','OLAPSYS','DBSNMP','TSMSYS','SCOTT','OUTLN','RMAN','XDB','PERFSTAT','SPLEX')"
column chain_cnt format 999G999G999G999
column num_rows format 999G999G999G999
timing start 'Total Duration';
set heading off;

COLUMN defdbname NEW_VAL dbname
COLUMN defdbuser NEW_VAL dbuser
COLUMN deflogmode NEW_VAL log_mode
COLUMN defcreated NEW_VAL crdate
COLUMN defversion new_val version
COLUMN defbanner NEW_VAL banner
COLUMN defcompatible NEW_VAL compatible
COLUMN defstartuptime NEW_VAL inststartup
COLUMN defsysdate NEW_VAL sysdatum
COLUMN defhostname NEW_VAL host
COLUMN defplatform NEW_VAL platform
COLUMN defcharset NEW_VAL charset
COLUMN defncharset NEW_VAL ncharset
COLUMN defrac NEW_VAL rac

SELECT name AS defdbname,
       TO_CHAR(created,'DD.MM.YYYY HH24:MI:SS') AS defcreated,
       log_mode AS deflogmode
FROM   v$database;

SELECT USER AS defdbuser
FROM   dual;

SELECT version AS defversion,
       TO_CHAR(startup_time,'DD.MM.YYYY HH24:MI:SS') as defstartuptime
FROM   v$instance;

SELECT banner AS defbanner
FROM   v$version
WHERE  ROWNUM = 1;

SELECT value AS defcompatible
FROM   v$parameter
WHERE  name = 'compatible';

SELECT TO_CHAR(SYSDATE,'DD.MM.YYYY HH24:MI:SS') AS defsysdate
FROM   dual;

SELECT host_name AS defhostname
FROM   v$instance;

SELECT platform_name AS defplatform
FROM   v$database;

SELECT value AS defcharset
FROM   nls_database_parameters
WHERE  parameter = 'NLS_CHARACTERSET';

SELECT value AS defncharset
FROM   nls_database_parameters
WHERE  parameter = 'NLS_NCHAR_CHARACTERSET';

SELECT DECODE(value,'TRUE','YES','NO') AS defrac
FROM   v$parameter
WHERE  name = 'cluster_database';

spool &dbname..lst

PROMPT *********************************************************************
PROMPT ****     Report Date                             : &sysdatum     ****
PROMPT ****     Report for Database                     : &dbname       ****
PROMPT ****     User                                    : &dbuser       ****
PROMPT ****     Software Version                        : &version      ****
PROMPT ****     Effective Version (compatible parameter): &compatible   ****
PROMPT ****     Banner                                  : &banner       ****
PROMPT ****     Platform name                           : &platform     ****
PROMPT ****     Server name                             : &host         ****
PROMPT ****     Database logging mode                   : &log_mode     ****
PROMPT ****     Database creation date                  : &crdate       ****
PROMPT ****     Instance startup time                   : &inststartup  ****
PROMPT ****     Database characterset                   : &charset      ****
PROMPT ****     Database national characterset          : &ncharset     ****
PROMPT ****     RAC (9.0.1 +)                           : &rac          ****
PROMPT *********************************************************************
PROMPT
PROMPT

set heading on;
timing start 'SuppLog';

PROMPT
PROMPT
PROMPT *********************************************************************
PROMPT ****     Check for supplemental logging                          ****
PROMPT ****     (for Oracle 9/10: should be at least MIN level;         ****
PROMPT ****     for SP6.0 and higher: PK/UI level is even better;       ****
PROMPT ****     for Oracle 8i: not applicable)                          ****
PROMPT *********************************************************************
SET HEADING OFF

SET SERVEROUTPUT ON
DECLARE
  suplog_min_avail NUMBER;
  suplog_pk_avail NUMBER;
  suplog_ui_avail NUMBER;
  suplog_fk_avail NUMBER;
  suplog_all_avail NUMBER;
  suplog_pl_avail NUMBER;
  suplog_min VARCHAR2(20);
  suplog_pk VARCHAR2(20);
  suplog_ui VARCHAR2(20);
  suplog_fk VARCHAR2(20);
  suplog_all VARCHAR2(20);
  suplog_pl VARCHAR2(20);
BEGIN
  SELECT SUM(DECODE(column_name,'SUPPLEMENTAL_LOG_DATA_MIN',1,0)),
         SUM(DECODE(column_name,'SUPPLEMENTAL_LOG_DATA_PK',1,0)),
         SUM(DECODE(column_name,'SUPPLEMENTAL_LOG_DATA_UI',1,0)),
         SUM(DECODE(column_name,'SUPPLEMENTAL_LOG_DATA_FK',1,0)),
         SUM(DECODE(column_name,'SUPPLEMENTAL_LOG_DATA_ALL',1,0)),
         SUM(DECODE(column_name,'SUPPLEMENTAL_LOG_DATA_PL',1,0))
  INTO suplog_min_avail,suplog_pk_avail,suplog_ui_avail,suplog_fk_avail,suplog_all_avail,suplog_pl_avail
  FROM dba_tab_columns
  WHERE owner = 'SYS'
  AND table_name = 'V_$DATABASE';

  IF suplog_min_avail = 1 THEN
    EXECUTE IMMEDIATE 'SELECT supplemental_log_data_min FROM v$database' INTO suplog_min;
  ELSE
    suplog_min := 'N.A.';
  END IF;

  IF suplog_pk_avail = 1 THEN
    EXECUTE IMMEDIATE 'SELECT supplemental_log_data_pk FROM v$database' INTO suplog_pk ;
  ELSE
    suplog_pk := 'N.A.';
  END IF;

  IF suplog_ui_avail = 1 THEN
    EXECUTE IMMEDIATE 'SELECT supplemental_log_data_ui FROM v$database' INTO suplog_ui ;
  ELSE
    suplog_ui := 'N.A.';
  END IF;

  IF suplog_fk_avail = 1 THEN
    EXECUTE IMMEDIATE 'SELECT supplemental_log_data_fk FROM v$database' INTO suplog_fk ;
  ELSE
    suplog_fk := 'N.A.';
  END IF;

  IF suplog_all_avail = 1 THEN
    EXECUTE IMMEDIATE 'SELECT supplemental_log_data_all FROM v$database' INTO suplog_all ;
  ELSE
    suplog_all := 'N.A.';
  END IF;

  IF suplog_pl_avail = 1 THEN
    EXECUTE IMMEDIATE 'SELECT supplemental_log_data_pl FROM v$database' INTO suplog_pl ;
  ELSE
    suplog_pl := 'N.A.';
  END IF;

  DBMS_OUTPUT.PUT_LINE('MIN       PK        UI        FK        ALL       PL');
  DBMS_OUTPUT.PUT_LINE('----------------------------------------------------');
  DBMS_OUTPUT.PUT_LINE(RPAD(suplog_min,10) || RPAD(suplog_pk,10) || RPAD(suplog_ui,10) || RPAD(suplog_fk,10) || RPAD(suplog_all,10) || RPAD(suplog_pl,10));
END;
/

prompt *********************************************************************
prompt ****     Database Parameter Settings                             ****
prompt ****     Looking for things out of the norm or                   ****
prompt ****     inconsistent for a healthy database                     ****
prompt *********************************************************************
set heading on;
col Parameter for a35;
col Setting for a50;
select substr(name,1,35) as "Parameter", substr(value,1,50) as "Setting" from v$parameter order by name;
timing stop Params;
timing stop 'Total Duration';

set heading off;
prompt *********************************************************************
prompt ****     PARALLELISM Settings                                    ****
prompt ****     SPLEX does not support PARALLELISM                      ****
prompt *********************************************************************
timing start Params;
select decode(value,1,'LOG PARALLELISM OK','LOG PARALLELISM IS NOT 1') from v$parameter where name = 'log_parallelism';
select decode(value,0,'RECOVERY PARALLELISM OK','RECOVERY PARALLELISM IS NOT 0') from v$parameter where name = 'recovery_parallelism';


PROMPT *********************************************************************
PROMPT ****     Tables with NOLOGGING attribute set                     ****
PROMPT ****     (please doublecheck if FORCELOGGING is set              ****
PROMPT ****     at either tablespace or database level                  ****
PROMPT ****     and whether these tables should be replicated at all    ****
PROMPT *********************************************************************

COLUMN table_name FORMAT A30

SELECT owner, table_name, NULL AS partition_name, NULL AS subpartition_name
FROM   dba_tables
WHERE  logging = 'NO' AND temporary = 'N'
AND    owner NOT IN &user_exclusion
UNION
SELECT table_owner AS owner, table_name, partition_name, NULL AS subpartition_name
FROM   dba_tab_partitions
WHERE  logging = 'NO'
AND    table_owner NOT IN &user_exclusion
UNION
SELECT table_owner AS owner, table_name, partition_name, subpartition_name
FROM   dba_tab_subpartitions
WHERE  logging = 'NO'
AND    table_owner NOT IN &user_exclusion;
timing stop 'SuppLog';

set heading off;
prompt *********************************************************************
prompt ****     List of Objects by Schema Owner                         ****
prompt ****     Primarily for informational purposes                    ****
prompt *********************************************************************
timing start 'Schema Obj';
set heading on;
col username for a30
col Tabs  format 999999
col Indx  format 999999
col Syns  format 999999
col Views format 999999
col Seqs  format 999999
col Procs format 999999
col Funcs format 999999
col Pkgs  format 999999
col Trigs format 999999
col Deps  format 999999


compute sum of "Tabs"  on report
compute sum of "Indx" on report
compute sum of "Syns" on report
compute sum of "Views" on report
compute sum of "Seqs" on report
compute sum of "Procs" on report
compute sum of "Funcs" on report
compute sum of "Pkgs" on report
compute sum of "Trigs" on report
compute sum of "Deps" on report
break on report
select   USERNAME,
         count(decode(o.TYPE#, 2,o.OBJ#,'')) as "Tabs",
         count(decode(o.TYPE#, 1,o.OBJ#,'')) as "Indx",
         count(decode(o.TYPE#, 5,o.OBJ#,'')) as "Syns",
         count(decode(o.TYPE#, 4,o.OBJ#,'')) as "Views",
         count(decode(o.TYPE#, 6,o.OBJ#,'')) as "Seqs",
         count(decode(o.TYPE#, 7,o.OBJ#,'')) as "Procs",
         count(decode(o.TYPE#, 8,o.OBJ#,'')) as "Funcs",
         count(decode(o.TYPE#, 9,o.OBJ#,'')) as "Pkgs",
         count(decode(o.TYPE#,12,o.OBJ#,'')) as "Trigs",
         count(decode(o.TYPE#,10,o.OBJ#,'')) as "Deps"
from     sys.obj$ o, dba_users u
where    u.USER_ID = o.OWNER# (+)
and      o.TYPE# is NOT NULL
and      u.username not in &user_exclusion
group by USERNAME
order by USERNAME;
clear breaks;
timing stop 'Schema Obj';

set heading off;
prompt *********************************************************************
prompt ****     Tablespace Info                                         ****
prompt ****     mostly informational                                    ****
prompt *********************************************************************
timing start 'Tablespace Info';

set heading on;
break on report
compute sum of "total MB" on report
col "total MB" format 999G999G990
compute sum of "Free MB" on report
col "Free MB" format 999G999G990
compute sum of "Used MB" on report
col "Used MB" format 999G999G990
column tablespace_name format a30
column "Datafile name" format a50
select
 d.tablespace_name,
 SUBSTR(d.file_name,1,50) "Datafile name",
 ROUND(MAX(d.bytes)/1024/1024,2) as "total MB",
 DECODE(SUM(f.bytes), null, 0, ROUND(SUM(f.Bytes)/1024/1024,2)) as "Free MB" ,
 DECODE( SUM(f.Bytes), null, 0, ROUND((MAX(d.bytes)/1024/1024) - (SUM(f.bytes)/1024/1024),2)) as "Used MB"
from
  DBA_FREE_SPACE f , DBA_DATA_FILES d
where
 f.tablespace_name = d.tablespace_name
 and f.file_id = d.file_id
group by
d.tablespace_name,d.file_name;

clear breaks

prompt *********************************************************************
prompt ****     Database size Info                                      ****
prompt *********************************************************************


col "Database Size" format a20
col "Free space" format a20
col "Used space" format a20
select round(sum(used.bytes) / 1024 / 1024) || ' MB'"Database Size"
, round(sum(used.bytes) / 1024 / 1024 ) -
round(free.p / 1024 / 1024) || ' MB'"Used space"
, round(free.p / 1024 / 1024) || ' MB'"Free space"
from (select bytes
from v$datafile
union all
select bytes
from v$tempfile
union all
select bytes
from v$log) used
, (select sum(bytes) as p
from dba_free_space) free
group by free.p;

timing stop 'Tablespace Info';

set heading off;
prompt *********************************************************************
prompt ****     Redo Log Files and Sizing                               ****
prompt *********************************************************************
timing start 'Redo Sizing';

set heading on;
col "File Name" for a80;
col "Size in MB" format 999G999G999G999G990
select substr(a.member,1,80) as "File Name",b.bytes/1024/1024 as "Size in MB"
from v$logfile a,v$log b where a.group#=b.group#;
timing stop 'Redo Sizing';

set heading off;
prompt *********************************************************************
prompt ****     Redolog Switch Rate by Date and Hour                    ****
prompt *********************************************************************
timing start 'Redo Switch Rate';

set heading on;
column day format a3
col Total for 99G990;
col h00 for 999;
col h01 for 999;
col h02 for 999;
col h03 for 999;
col h04 for 999;
col h05 for 999;
col h06 for 999;
col h07 for 999;
col h08 for 999;
col h09 for 999;
col h10 for 999;
col h11 for 999;
col h12 for 999;
col h13 for 999;
col h14 for 999;
col h15 for 999;
col h16 for 999;
col h17 for 999;
col h18 for 999;
col h19 for 999;
col h20 for 999;
col h21 for 999;
col h22 for 999;
col h23 for 999;
col h24 for 999;


break on report
compute max of "Total" on report
compute max of "h00" on report
compute max of "h01" on report
compute max of "h02" on report
compute max of "h03" on report
compute max of "h04" on report
compute max of "h05" on report
compute max of "h06" on report
compute max of "h07" on report
compute max of "h08" on report
compute max of "h09" on report
compute max of "h10" on report
compute max of "h11" on report
compute max of "h12" on report
compute max of "h13" on report
compute max of "h14" on report
compute max of "h15" on report
compute max of "h16" on report
compute max of "h17" on report
compute max of "h18" on report
compute max of "h19" on report
compute max of "h20" on report
compute max of "h21" on report
compute max of "h22" on report
compute max of "h23" on report

SELECT  trunc(first_time) "Date",
        to_char(first_time, 'Dy') "Day",
        count(1) as "Total",
        SUM(decode(to_char(first_time, 'hh24'),'00',1,0)) as "h00",
        SUM(decode(to_char(first_time, 'hh24'),'01',1,0)) as "h01",
        SUM(decode(to_char(first_time, 'hh24'),'02',1,0)) as "h02",
        SUM(decode(to_char(first_time, 'hh24'),'03',1,0)) as "h03",
        SUM(decode(to_char(first_time, 'hh24'),'04',1,0)) as "h04",
        SUM(decode(to_char(first_time, 'hh24'),'05',1,0)) as "h05",
        SUM(decode(to_char(first_time, 'hh24'),'06',1,0)) as "h06",
        SUM(decode(to_char(first_time, 'hh24'),'07',1,0)) as "h07",
        SUM(decode(to_char(first_time, 'hh24'),'08',1,0)) as "h08",
        SUM(decode(to_char(first_time, 'hh24'),'09',1,0)) as "h09",
        SUM(decode(to_char(first_time, 'hh24'),'10',1,0)) as "h10",
        SUM(decode(to_char(first_time, 'hh24'),'11',1,0)) as "h11",
        SUM(decode(to_char(first_time, 'hh24'),'12',1,0)) as "h12",
        SUM(decode(to_char(first_time, 'hh24'),'13',1,0)) as "h13",
        SUM(decode(to_char(first_time, 'hh24'),'14',1,0)) as "h14",
        SUM(decode(to_char(first_time, 'hh24'),'15',1,0)) as "h15",
        SUM(decode(to_char(first_time, 'hh24'),'16',1,0)) as "h16",
        SUM(decode(to_char(first_time, 'hh24'),'17',1,0)) as "h17",
        SUM(decode(to_char(first_time, 'hh24'),'18',1,0)) as "h18",
        SUM(decode(to_char(first_time, 'hh24'),'19',1,0)) as "h19",
        SUM(decode(to_char(first_time, 'hh24'),'20',1,0)) as "h20",
        SUM(decode(to_char(first_time, 'hh24'),'21',1,0)) as "h21",
        SUM(decode(to_char(first_time, 'hh24'),'22',1,0)) as "h22",
        SUM(decode(to_char(first_time, 'hh24'),'23',1,0)) as "h23"
FROM    V$log_history
group by trunc(first_time), to_char(first_time, 'Dy')
Order by 1;

clear breaks
timing stop 'Redo Switch Rate';

set heading off;
prompt *********************************************************************
prompt ****     Redolog Daily and Hourly volume calculated              ****
prompt *********************************************************************

timing start Redovol;

--##########################################################################
--##  PL/SQL used here to gather and display average redo volumes         ##
--##########################################################################

set serveroutput on;
set feedback off
declare

v_log    number;
v_days   number;
v_logsz  number;
v_adsw   number;
V_advol  number;
v_ahsw   number;
v_ahvol  number;


begin

select count(first_time) into v_log from v$log_history;
select count(distinct(to_char(first_time,'dd-mon-rrrr'))) into v_days from v$log_history;
select max(bytes)/1024/1024 into v_logsz from v$log;

v_adsw := round(v_log / v_days);
v_advol := round(v_adsw * v_logsz);
v_ahsw := round(v_adsw / 24);
v_ahvol := round((v_adsw / 24 )) * v_logsz;

dbms_output.put_line('');
dbms_output.put ('Total Switches' || ''||v_log||'  ==>  ');
dbms_output.put ('Total Days' || ''|| v_days||'  ==>  ');
dbms_output.put_line ('Redo Size' || '' || v_logsz);
dbms_output.put ('Avg Daily Switches' || '' || v_adsw||'  ==>  ');
dbms_output.put_line ('Avg Daily Volume in Meg' || '' || v_advol);
dbms_output.put ('Avg Hourly Switches' || '' || v_ahsw||'  ==>  ');
dbms_output.put_line ('Avg Hourly Volume in Meg' || '' || v_ahvol);
dbms_output.put_line('');


end;

/

timing stop Redovol;
set heading off;
PROMPT *********************************************************************
PROMPT ****  The above is to help you compute the amount of disk space  ****
PROMPT ****  needed for the SharePlex queues. Use the below formula.    ****
PROMPT ****                                                             ****
PROMPT ****  [size of a redo log] x [# of log switches in 1 hour]       ****
PROMPT ****  x 1/3  x [number of hours downtime]                        ****
PROMPT ****  = amount of disk space needed for the queues on each system****
PROMPT ****                                                             ****
PROMPT ****  For example,                                               ****
PROMPT ****  if you expect to recover from 8 hours of downtime,         ****
PROMPT ****  and your redo logs are 500 MB in size                      ****
PROMPT ****  and switch five times an hour,                             ****
PROMPT ****  then you could need 6.5 GB of                              ****
PROMPT ****  space on both the source and target machines               ****
PROMPT ****  for the SharePlex queues.                                  ****
PROMPT ****  [500 MB redo log] x [5 switches/hour] x [1/3] x [8 hours]  ****
PROMPT ****  = 6.5 GB disk space                                        ****
PROMPT *********************************************************************
PROMPT
PROMPT
PROMPT
PROMPT
PROMPT
PROMPT *********************************************************************
PROMPT ****     CLUSTERED TABLES                                        ****
PROMPT ****     NOT SUPPORTED                                           ****
PROMPT *********************************************************************
timing start Cluster;
set heading on;
SELECT owner, cluster_name, cluster_type, single_table
FROM   dba_clusters
WHERE  owner NOT IN &user_exclusion
ORDER BY owner, cluster_name;
timing stop Cluster;

set heading off;
PROMPT
PROMPT
PROMPT *********************************************************************
PROMPT ****     Tablespaces with Transparent Data Encryption            ****
PROMPT ****     Prior to SP 8.0: NOT SUPPORTED                          ****
PROMPT *********************************************************************
timing start TS_TDE;
set heading on;

SELECT t.name
FROM   v$encrypted_tablespaces e, sys.ts$ t
WHERE  e.ts# = t.ts#
AND    e.encryptedts = 'YES';
timing stop TS_TDE;

set heading off;

PROMPT
PROMPT
PROMPT *********************************************************************
PROMPT ****     Compressed tables, partitions or subpartitions          ****
PROMPT ****     Supported only for Oracle 11gR2+ and SP 7.6+            ****
PROMPT ****     If that not applies and partitioned table, then         ****
PROMPT ****     doublecheck if partitions are actually compressed       ****
PROMPT ****     - If yes: NOT SUPPORTED                                 ****
PROMPT ****     - If no:  Check to just change default compression      ****
PROMPT ****     -         attribute of the table                        ****
PROMPT *********************************************************************
timing start compress_table;
set heading on;
SELECT owner, table_name,compression,compress_for, NULL AS partition_name, NULL AS subpartition_name,
  CASE WHEN compress_for IN ('BASIC','DIRECT LOAD ONLY') THEN 'Yes (for 11gR2+ and SP7.6+)'
       WHEN compress_for IN ('OLTP','FOR ALL OPERATIONS') THEN 'Yes (for 11gR2+ and SP7.6+)'
       WHEN compress_for IN ('QUERY LOW','QUERY HIGH','ARCHIVE LOW','ARCHIVE HIGH') THEN 'No (Exadata HCC)'
       ELSE 'Please doublecheck! (Unknown compression type: ' || compress_for || ')'
  END AS "Supported?"
FROM dba_tables
WHERE compression = 'ENABLED'
AND   owner NOT IN &user_exclusion
UNION
SELECT table_owner AS owner, table_name,compression,compress_for, partition_name, NULL AS subpartition_name,
  CASE WHEN compress_for IN ('BASIC','DIRECT LOAD ONLY') THEN 'Yes (for 11gR2+ and SP7.6+)'
       WHEN compress_for IN ('OLTP','FOR ALL OPERATIONS') THEN 'Yes (for 11gR2+ and SP7.6+)'
       WHEN compress_for IN ('QUERY LOW','QUERY HIGH','ARCHIVE LOW','ARCHIVE HIGH') THEN 'No (Exadata HCC)'
       ELSE 'Please doublecheck! (Unknown compression type: ' || compress_for || ')'
  END AS "Supported?"
FROM dba_tab_partitions
WHERE compression = 'ENABLED'
AND   table_owner NOT IN &user_exclusion
UNION
SELECT table_owner AS owner, table_name,compression,compress_for, partition_name, subpartition_name,
  CASE WHEN compress_for IN ('BASIC','DIRECT LOAD ONLY') THEN 'Yes (for 11gR2+ and SP7.6+)'
       WHEN compress_for IN ('OLTP','FOR ALL OPERATIONS') THEN 'Yes (for 11gR2+ and SP7.6+)'
       WHEN compress_for IN ('QUERY LOW','QUERY HIGH','ARCHIVE LOW','ARCHIVE HIGH') THEN 'No (Exadata HCC)'
       ELSE 'Please doublecheck! (Unknown compression type: ' || compress_for || ')'
  END AS "Supported?"
FROM dba_tab_subpartitions
WHERE compression = 'ENABLED'
AND   table_owner NOT IN &user_exclusion
ORDER BY owner, table_name, partition_name, subpartition_name;


set heading off;
PROMPT
PROMPT
PROMPT *********************************************************************
PROMPT ****     Columns with Transparent Data Encryption                ****
PROMPT ****     Prior to SP 7.6: NOT SUPPORTED                          ****
PROMPT ****     Starting with SP 7.6: Supported for some datatypes      ****
PROMPT ****     Not supported for Shareplex key columns!                ****
PROMPT ****     Column on target database has to be nullable!           ****
PROMPT *********************************************************************
timing start TDE;
set heading on;
COLUMN owner FORMAT A20
COLUMN table_name FORMAT A30
COLUMN column_name FORMAT A20
COLUMN "Datatype supported?" FORMAT A30
COLUMN "Part ok Shareplex Key?" FORMAT A40
COLUMN nullable FORMAT A8
SELECT tc.owner, tc.table_name, tc.column_name,
  CASE WHEN tc.data_type IN ('CHAR', 'NCHAR', 'VARCHAR2', 'NVARCHAR2', 'NUMBER', 'DATE', 'RAW') THEN 'Yes with SP7.6+ ('
       ELSE 'No ('
  END || data_type || ')' AS "Datatype supported?",
  CASE WHEN c.constraint_name IS NULL THEN 'No PK (check for Shareplex key!)'
       WHEN c.constraint_name IS NOT NULL AND cc.column_name IS NULL THEN 'Yes'
           ELSE 'No (different Shareplex key?)'
  END AS "Outside of Primary Key?" ,
  tc.nullable
FROM   dba_encrypted_columns ec
       INNER JOIN dba_tab_cols tc ON (tc.owner = ec.owner AND tc.table_name = ec.table_name AND tc.column_name = ec.column_name)
       LEFT OUTER JOIN dba_constraints c ON (tc.owner = c.owner AND tc.table_name = c.table_name AND c.constraint_type = 'P')
       LEFT OUTER JOIN dba_cons_columns cc ON (c.owner = cc.owner AND c.constraint_name = cc.constraint_name AND tc.column_name = cc.column_name)
WHERE  ec.owner NOT IN &user_exclusion
ORDER BY SUBSTR("Datatype supported?",1,1) ASC,
         SUBSTR("Outside of Primary Key?",1,1) ASC,
                 nullable ASC,
                 owner, table_name, column_name;

timing stop TDE;

set heading off;
PROMPT
PROMPT
PROMPT *********************************************************************
PROMPT ****     SecuredFile LOBs                                        ****
PROMPT ****     Prior to SP 7.6: Not supported                          ****
PROMPT ****     SP 7.6 or higher: SecureFile LOBs with LOGGING and      ****
PROMPT ****     without encryption, compression                         ****
PROMPT ****     and dedup are supported                                 ****
PROMPT *********************************************************************

COLUMN owner FORMAT A20
COLUMN table_name FORMAT A30
COLUMN column_name FORMAT A20
COLUMN partition_name FORMAT A20
COLUMN subpartition_name FORMAT A20
COLUMN "ENC,COMPR,DEDUP,LOGGING" FORMAT A25
SELECT owner, table_name, column_name, partition_name, subpartition_name,
       encrypt || ',' || compression  || ',' || deduplication  || ',' || logging AS "ENC,COMPR,DEDUP,LOGGING",
       CASE
             WHEN encrypt IN ('NO','NONE') AND compression IN ('NO','NONE') AND deduplication IN ('NO','NONE') AND logging IN ('YES','NONE') THEN 'Yes (with SP7.6+)'
                 ELSE 'No'
           END AS "Supported?"
FROM (
  SELECT owner, table_name, column_name, NULL AS partition_name, NULL AS subpartition_name, encrypt, compression, deduplication, logging
  FROM   dba_lobs
  WHERE  securefile='YES'
  AND    owner NOT IN &user_exclusion
  UNION
  SELECT table_owner, table_name, column_name, partition_name, NULL AS subpartition_name, encrypt, compression, deduplication, logging
  FROM   dba_lob_partitions
  WHERE  securefile='YES'
  AND    table_owner NOT IN &user_exclusion
  UNION
  SELECT table_owner, table_name, column_name, lob_partition_name AS partition_name, subpartition_name, encrypt, compression, deduplication, logging
  FROM   dba_lob_subpartitions
  WHERE  securefile='YES'
  AND    table_owner NOT IN &user_exclusion)
ORDER BY owner, table_name, column_name, partition_name, subpartition_name;
timing stop 'Lobdef';

set heading off;
PROMPT
PROMPT
PROMPT
PROMPT
PROMPT
prompt *********************************************************************
prompt ****     NOTE                                                    ****
prompt ****     THE Next 2 sections should be looked at                 ****
prompt ****     Check NonBasic Datatypes for any unsopported data types ****
prompt ****     Check if the Schema owners of of the nested objects are ****
prompt ****     the same on source and target.                          ****
prompt *********************************************************************
PROMPT
PROMPT
set heading off;
prompt *********************************************************************
prompt ****     List of non-basic Data Types Contained in the Database  ****
prompt ****     Check NonBasic Datatypes for any unsopported data types ****
prompt *********************************************************************
timing start 'NonBasic Datatypes';

set heading on;
select a.owner, a.table_name, a.column_name,a.data_type from dba_tab_columns a, dba_objects b
where data_type not in ('VARCHAR','VARCHAR2','DATE','NUMBER','NVARCHAR2','TIMESTAMP%','LOB','BLOB','CLOB','LONG','LONG RAW','CHAR','ROWID','RAW','FLOAT','NCLOB') and
a.owner not in &user_exclusion
and a.table_name = b.object_name
and b.object_type = 'TABLE'
order by a.owner;
timing stop 'NonBasic Datatypes';

set heading off;
prompt *********************************************************************
prompt ****      List of Nested Arrays                                  ****
prompt ****      For UDTs Only                                          ****
prompt ****      Check if the Schema owners of of the nested            ****
prompt ****      objects are the same on source and target.             ****
prompt *********************************************************************
timing start 'NestArray';

Set heading on;
select b.owner,b.attr_type_name as "Nested Array", b.type_name as "Nested In Type", b.attr_name as "Nested in Column"
from dba_type_attrs b
where b.attr_type_name in (select a.type_name from dba_types a where a.owner
not in &user_exclusion and typecode = 'COLLECTION')
order by b.owner;
timing stop 'NestArray';

set heading off;
PROMPT
PROMPT
PROMPT
PROMPT
PROMPT
prompt *********************************************************************
prompt ****     NOTE                                                    ****
prompt ****     THE REMAINING OUTPUT IS IMFORMATIONAL AND               ****
prompt ****     USED FOR IMPLEMENTATION AND PLANNING PURPOSES           ****
prompt ****     ESMs may ignore                                         ****
prompt *********************************************************************
PROMPT
PROMPT
PROMPT
PROMPT
PROMPT
set heading off;
prompt *********************************************************************
prompt ****     List of Tables with more than 254 columns               ****
prompt *********************************************************************
timing start '254ormore';

set heading on;
column owner format a30
column table_name format a30
column numcols format 999G999G999

select owner,table_name,count(table_name) as "NumCols"
from dba_tab_columns where owner not in &user_exclusion
group by owner,table_name having count(table_name) > 254
order by owner;
timing stop '254ormore';

set heading off;
prompt *********************************************************************
prompt ****     List of Tables that contain LONG data types             ****
prompt *********************************************************************
timing start 'Long Lob';

set heading on;
column column_name format a30
column table_name format A30
column data_type format a30
select owner,table_name,column_name,data_type from dba_tab_columns where data_type in ('LONG')
and owner not in &user_exclusion
order by owner;
timing stop 'Long Lob';

prompt *********************************************************************
prompt ****     Listing of Index Organized Tables                       ****
prompt *********************************************************************
timing start IOTs;

set heading on;
select owner,table_name,iot_type
from dba_tables
where iot_type = 'IOT'
and owner not in &user_exclusion
order by owner;
timing stop IOTs;

set heading off;
prompt *********************************************************************
prompt ****     Listing of Bitmap Indexes                               ****
prompt *********************************************************************
timing start Bitmaps;

set heading on;
select owner,index_name,table_owner,table_name
from dba_indexes where index_type = 'BITMAP'
order by owner;
timing stop Bitmaps;

set heading off;
prompt *********************************************************************
prompt ****     List of Data Types Contained in the Database            ****
prompt *********************************************************************
timing start Datatypes;

set heading on;
select distinct data_type from dba_tab_columns
where owner not in &user_exclusion;
timing stop Datatypes;

set heading off;
prompt *********************************************************************
prompt ****     List of Tables with size > 100 MB                       ****
prompt *********************************************************************
timing start Largetable;

set heading on;
column MBYTE format 999G999G990
column PCT_FREE format 999
column PCT_USED format 999
select t.owner, t.table_name, t.tablespace_name, s.bytes/1024/1024 MBYTE, t.pct_free, t.pct_used, t.num_rows, t.chain_cnt, t.blocks
from dba_tables t, dba_segments s
where t.owner = s.owner
and t.table_name = s.segment_name
and t.owner not in &user_exclusion
and s.bytes > 100000000
order by t.owner, t.table_name;
timing stop Largetable;


set heading off;
prompt *********************************************************************
prompt ****     list of tables not analysed for the last 30 days        ****
prompt *********************************************************************
timing start Analyzed;

set heading on;
select owner, table_name, to_char(last_analyzed,'DD-MON-RR') as "Analyzed"
from dba_tables
where last_analyzed is not NULL
and last_analyzed < sysdate-30
and owner not in &user_exclusion
order by 1,2,3;
timing stop Analyzed;

set heading off;
prompt *********************************************************************
prompt ****     List of Tables Created in the last 60 Days              ****
prompt *********************************************************************
timing start Created;

set heading on;
col "Table_Nm" for a30;
select owner, substr(object_name,1,30) as "Table_Nm",created
from dba_objects where object_type = 'TABLE'
and created > sysdate-60
and owner not in &user_exclusion
order by 1,2;

timing stop Created;

set heading off;
prompt *********************************************************************
prompt ****     Count of triggers by Row Level and then Statement Level ****
prompt *********************************************************************
timing start Triggers;

set heading on;
select count(trigger_type) as "Row Level"
from dba_triggers
where trigger_type like '%ROW%'
and owner not in &user_exclusion;

set heading off;
prompt *** Statement Level ****
set heading on;
select owner,trigger_name,trigger_type,table_owner,table_name
from dba_triggers
where trigger_type not like '%ROW%'
and owner not in &user_exclusion
order by owner;

timing stop Triggers;

set heading off;
prompt *********************************************************************
prompt ****     List Constraints with On-Delete Cascades                ****
prompt *********************************************************************
timing start OnDelCasc;

set heading on;

select owner,constraint_name,table_name from dba_constraints
where delete_rule = 'CASCADE'
and owner not in &user_exclusion
order by owner;
timing stop OnDelCasc;




set heading off;

--##########################################################################
--##                                     END of PL/SQL routine            ##
--##########################################################################
set heading on;


spool off;

prompt *********************************************************************
prompt ****     &dbname..lst has been generated.                        ****
prompt ****     Please send it to Quest Software                        ****
prompt *********************************************************************


set verify on;
-- Script Name:         Cust_DBInfo_v921.sql

set termout on
set verify off;
set linesize 300;
set pagesize 1000;
set trimspool on
define user_exclusion="('SYS','SYSTEM','MDSYS','ORDSYS','EXFSYS','DMSYS','WMSYS','CTXSYS','SYSMAN','OLAPSYS','DBSNMP','TSMSYS','SCOTT','OUTLN','RMAN','XDB','PERFSTAT','SPLEX')"
column chain_cnt format 999G999G999G999
column num_rows format 999G999G999G999
timing start 'Total Duration';
set heading off;

COLUMN defdbname NEW_VAL dbname
COLUMN defdbuser NEW_VAL dbuser
COLUMN deflogmode NEW_VAL log_mode
COLUMN defcreated NEW_VAL crdate
COLUMN defversion new_val version
COLUMN defbanner NEW_VAL banner
COLUMN defcompatible NEW_VAL compatible
COLUMN defstartuptime NEW_VAL inststartup
COLUMN defsysdate NEW_VAL sysdatum
COLUMN defhostname NEW_VAL host
COLUMN defplatform NEW_VAL platform
COLUMN defcharset NEW_VAL charset
COLUMN defncharset NEW_VAL ncharset
COLUMN defrac NEW_VAL rac

SELECT name AS defdbname,
       TO_CHAR(created,'DD.MM.YYYY HH24:MI:SS') AS defcreated,
       log_mode AS deflogmode
FROM   v$database;

SELECT USER AS defdbuser
FROM   dual;

SELECT version AS defversion,
       TO_CHAR(startup_time,'DD.MM.YYYY HH24:MI:SS') as defstartuptime
FROM   v$instance;

SELECT banner AS defbanner
FROM   v$version
WHERE  ROWNUM = 1;

SELECT value AS defcompatible
FROM   v$parameter
WHERE  name = 'compatible';

SELECT TO_CHAR(SYSDATE,'DD.MM.YYYY HH24:MI:SS') AS defsysdate
FROM   dual;

SELECT host_name AS defhostname
FROM   v$instance;

SELECT platform_name AS defplatform
FROM   v$database;

SELECT value AS defcharset
FROM   nls_database_parameters
WHERE  parameter = 'NLS_CHARACTERSET';

SELECT value AS defncharset
FROM   nls_database_parameters
WHERE  parameter = 'NLS_NCHAR_CHARACTERSET';

SELECT DECODE(value,'TRUE','YES','NO') AS defrac
FROM   v$parameter
WHERE  name = 'cluster_database';

spool &dbname..lst

PROMPT *********************************************************************
PROMPT ****     Report Date                             : &sysdatum     ****
PROMPT ****     Report for Database                     : &dbname       ****
PROMPT ****     User                                    : &dbuser       ****
PROMPT ****     Software Version                        : &version      ****
PROMPT ****     Effective Version (compatible parameter): &compatible   ****
PROMPT ****     Banner                                  : &banner       ****
PROMPT ****     Platform name                           : &platform     ****
PROMPT ****     Server name                             : &host         ****
PROMPT ****     Database logging mode                   : &log_mode     ****
PROMPT ****     Database creation date                  : &crdate       ****
PROMPT ****     Instance startup time                   : &inststartup  ****
PROMPT ****     Database characterset                   : &charset      ****
PROMPT ****     Database national characterset          : &ncharset     ****
PROMPT ****     RAC (9.0.1 +)                           : &rac          ****
PROMPT *********************************************************************
PROMPT
PROMPT

set heading on;
timing start 'SuppLog';

PROMPT
PROMPT
PROMPT *********************************************************************
PROMPT ****     Check for supplemental logging                          ****
PROMPT ****     (for Oracle 9/10: should be at least MIN level;         ****
PROMPT ****     for SP6.0 and higher: PK/UI level is even better;       ****
PROMPT ****     for Oracle 8i: not applicable)                          ****
PROMPT *********************************************************************
SET HEADING OFF

SET SERVEROUTPUT ON
DECLARE
  suplog_min_avail NUMBER;
  suplog_pk_avail NUMBER;
  suplog_ui_avail NUMBER;
  suplog_fk_avail NUMBER;
  suplog_all_avail NUMBER;
  suplog_pl_avail NUMBER;
  suplog_min VARCHAR2(20);
  suplog_pk VARCHAR2(20);
  suplog_ui VARCHAR2(20);
  suplog_fk VARCHAR2(20);
  suplog_all VARCHAR2(20);
  suplog_pl VARCHAR2(20);
BEGIN
  SELECT SUM(DECODE(column_name,'SUPPLEMENTAL_LOG_DATA_MIN',1,0)),
         SUM(DECODE(column_name,'SUPPLEMENTAL_LOG_DATA_PK',1,0)),
         SUM(DECODE(column_name,'SUPPLEMENTAL_LOG_DATA_UI',1,0)),
         SUM(DECODE(column_name,'SUPPLEMENTAL_LOG_DATA_FK',1,0)),
         SUM(DECODE(column_name,'SUPPLEMENTAL_LOG_DATA_ALL',1,0)),
         SUM(DECODE(column_name,'SUPPLEMENTAL_LOG_DATA_PL',1,0))
  INTO suplog_min_avail,suplog_pk_avail,suplog_ui_avail,suplog_fk_avail,suplog_all_avail,suplog_pl_avail
  FROM dba_tab_columns
  WHERE owner = 'SYS'
  AND table_name = 'V_$DATABASE';

  IF suplog_min_avail = 1 THEN
    EXECUTE IMMEDIATE 'SELECT supplemental_log_data_min FROM v$database' INTO suplog_min;
  ELSE
    suplog_min := 'N.A.';
  END IF;

  IF suplog_pk_avail = 1 THEN
    EXECUTE IMMEDIATE 'SELECT supplemental_log_data_pk FROM v$database' INTO suplog_pk ;
  ELSE
    suplog_pk := 'N.A.';
  END IF;

  IF suplog_ui_avail = 1 THEN
    EXECUTE IMMEDIATE 'SELECT supplemental_log_data_ui FROM v$database' INTO suplog_ui ;
  ELSE
    suplog_ui := 'N.A.';
  END IF;

  IF suplog_fk_avail = 1 THEN
    EXECUTE IMMEDIATE 'SELECT supplemental_log_data_fk FROM v$database' INTO suplog_fk ;
  ELSE
    suplog_fk := 'N.A.';
  END IF;

  IF suplog_all_avail = 1 THEN
    EXECUTE IMMEDIATE 'SELECT supplemental_log_data_all FROM v$database' INTO suplog_all ;
  ELSE
    suplog_all := 'N.A.';
  END IF;

  IF suplog_pl_avail = 1 THEN
    EXECUTE IMMEDIATE 'SELECT supplemental_log_data_pl FROM v$database' INTO suplog_pl ;
  ELSE
    suplog_pl := 'N.A.';
  END IF;

  DBMS_OUTPUT.PUT_LINE('MIN       PK        UI        FK        ALL       PL');
  DBMS_OUTPUT.PUT_LINE('----------------------------------------------------');
  DBMS_OUTPUT.PUT_LINE(RPAD(suplog_min,10) || RPAD(suplog_pk,10) || RPAD(suplog_ui,10) || RPAD(suplog_fk,10) || RPAD(suplog_all,10) || RPAD(suplog_pl,10));
END;
/

prompt *********************************************************************
prompt ****     Database Parameter Settings                             ****
prompt ****     Looking for things out of the norm or                   ****
prompt ****     inconsistent for a healthy database                     ****
prompt *********************************************************************
set heading on;
col Parameter for a35;
col Setting for a50;
select substr(name,1,35) as "Parameter", substr(value,1,50) as "Setting" from v$parameter order by name;
timing stop Params;
timing stop 'Total Duration';

set heading off;
prompt *********************************************************************
prompt ****     PARALLELISM Settings                                    ****
prompt ****     SPLEX does not support PARALLELISM                      ****
prompt *********************************************************************
timing start Params;
select decode(value,1,'LOG PARALLELISM OK','LOG PARALLELISM IS NOT 1') from v$parameter where name = 'log_parallelism';
select decode(value,0,'RECOVERY PARALLELISM OK','RECOVERY PARALLELISM IS NOT 0') from v$parameter where name = 'recovery_parallelism';


PROMPT *********************************************************************
PROMPT ****     Tables with NOLOGGING attribute set                     ****
PROMPT ****     (please doublecheck if FORCELOGGING is set              ****
PROMPT ****     at either tablespace or database level                  ****
PROMPT ****     and whether these tables should be replicated at all    ****
PROMPT *********************************************************************

COLUMN table_name FORMAT A30

SELECT owner, table_name, NULL AS partition_name, NULL AS subpartition_name
FROM   dba_tables
WHERE  logging = 'NO' AND temporary = 'N'
AND    owner NOT IN &user_exclusion
UNION
SELECT table_owner AS owner, table_name, partition_name, NULL AS subpartition_name
FROM   dba_tab_partitions
WHERE  logging = 'NO'
AND    table_owner NOT IN &user_exclusion
UNION
SELECT table_owner AS owner, table_name, partition_name, subpartition_name
FROM   dba_tab_subpartitions
WHERE  logging = 'NO'
AND    table_owner NOT IN &user_exclusion;
timing stop 'SuppLog';

set heading off;
prompt *********************************************************************
prompt ****     List of Objects by Schema Owner                         ****
prompt ****     Primarily for informational purposes                    ****
prompt *********************************************************************
timing start 'Schema Obj';
set heading on;
col username for a30
col Tabs  format 999999
col Indx  format 999999
col Syns  format 999999
col Views format 999999
col Seqs  format 999999
col Procs format 999999
col Funcs format 999999
col Pkgs  format 999999
col Trigs format 999999
col Deps  format 999999


compute sum of "Tabs"  on report
compute sum of "Indx" on report
compute sum of "Syns" on report
compute sum of "Views" on report
compute sum of "Seqs" on report
compute sum of "Procs" on report
compute sum of "Funcs" on report
compute sum of "Pkgs" on report
compute sum of "Trigs" on report
compute sum of "Deps" on report
break on report
select   USERNAME,
         count(decode(o.TYPE#, 2,o.OBJ#,'')) as "Tabs",
         count(decode(o.TYPE#, 1,o.OBJ#,'')) as "Indx",
         count(decode(o.TYPE#, 5,o.OBJ#,'')) as "Syns",
         count(decode(o.TYPE#, 4,o.OBJ#,'')) as "Views",
         count(decode(o.TYPE#, 6,o.OBJ#,'')) as "Seqs",
         count(decode(o.TYPE#, 7,o.OBJ#,'')) as "Procs",
         count(decode(o.TYPE#, 8,o.OBJ#,'')) as "Funcs",
         count(decode(o.TYPE#, 9,o.OBJ#,'')) as "Pkgs",
         count(decode(o.TYPE#,12,o.OBJ#,'')) as "Trigs",
         count(decode(o.TYPE#,10,o.OBJ#,'')) as "Deps"
from     sys.obj$ o, dba_users u
where    u.USER_ID = o.OWNER# (+)
and      o.TYPE# is NOT NULL
and      u.username not in &user_exclusion
group by USERNAME
order by USERNAME;
clear breaks;
timing stop 'Schema Obj';

set heading off;
prompt *********************************************************************
prompt ****     Tablespace Info                                         ****
prompt ****     mostly informational                                    ****
prompt *********************************************************************
timing start 'Tablespace Info';

set heading on;
break on report
compute sum of "total MB" on report
col "total MB" format 999G999G990
compute sum of "Free MB" on report
col "Free MB" format 999G999G990
compute sum of "Used MB" on report
col "Used MB" format 999G999G990
column tablespace_name format a30
column "Datafile name" format a50
select
 d.tablespace_name,
 SUBSTR(d.file_name,1,50) "Datafile name",
 ROUND(MAX(d.bytes)/1024/1024,2) as "total MB",
 DECODE(SUM(f.bytes), null, 0, ROUND(SUM(f.Bytes)/1024/1024,2)) as "Free MB" ,
 DECODE( SUM(f.Bytes), null, 0, ROUND((MAX(d.bytes)/1024/1024) - (SUM(f.bytes)/1024/1024),2)) as "Used MB"
from
  DBA_FREE_SPACE f , DBA_DATA_FILES d
where
 f.tablespace_name = d.tablespace_name
 and f.file_id = d.file_id
group by
d.tablespace_name,d.file_name;

clear breaks

prompt *********************************************************************
prompt ****     Database size Info                                      ****
prompt *********************************************************************


col "Database Size" format a20
col "Free space" format a20
col "Used space" format a20
select round(sum(used.bytes) / 1024 / 1024) || ' MB'"Database Size"
, round(sum(used.bytes) / 1024 / 1024 ) -
round(free.p / 1024 / 1024) || ' MB'"Used space"
, round(free.p / 1024 / 1024) || ' MB'"Free space"
from (select bytes
from v$datafile
union all
select bytes
from v$tempfile
union all
select bytes
from v$log) used
, (select sum(bytes) as p
from dba_free_space) free
group by free.p;

timing stop 'Tablespace Info';

set heading off;
prompt *********************************************************************
prompt ****     Redo Log Files and Sizing                               ****
prompt *********************************************************************
timing start 'Redo Sizing';

set heading on;
col "File Name" for a80;
col "Size in MB" format 999G999G999G999G990
select substr(a.member,1,80) as "File Name",b.bytes/1024/1024 as "Size in MB"
from v$logfile a,v$log b where a.group#=b.group#;
timing stop 'Redo Sizing';

set heading off;
prompt *********************************************************************
prompt ****     Redolog Switch Rate by Date and Hour                    ****
prompt *********************************************************************
timing start 'Redo Switch Rate';

set heading on;
column day format a3
col Total for 99G990;
col h00 for 999;
col h01 for 999;
col h02 for 999;
col h03 for 999;
col h04 for 999;
col h05 for 999;
col h06 for 999;
col h07 for 999;
col h08 for 999;
col h09 for 999;
col h10 for 999;
col h11 for 999;
col h12 for 999;
col h13 for 999;
col h14 for 999;
col h15 for 999;
col h16 for 999;
col h17 for 999;
col h18 for 999;
col h19 for 999;
col h20 for 999;
col h21 for 999;
col h22 for 999;
col h23 for 999;
col h24 for 999;


break on report
compute max of "Total" on report
compute max of "h00" on report
compute max of "h01" on report
compute max of "h02" on report
compute max of "h03" on report
compute max of "h04" on report
compute max of "h05" on report
compute max of "h06" on report
compute max of "h07" on report
compute max of "h08" on report
compute max of "h09" on report
compute max of "h10" on report
compute max of "h11" on report
compute max of "h12" on report
compute max of "h13" on report
compute max of "h14" on report
compute max of "h15" on report
compute max of "h16" on report
compute max of "h17" on report
compute max of "h18" on report
compute max of "h19" on report
compute max of "h20" on report
compute max of "h21" on report
compute max of "h22" on report
compute max of "h23" on report

SELECT  trunc(first_time) "Date",
        to_char(first_time, 'Dy') "Day",
        count(1) as "Total",
        SUM(decode(to_char(first_time, 'hh24'),'00',1,0)) as "h00",
        SUM(decode(to_char(first_time, 'hh24'),'01',1,0)) as "h01",
        SUM(decode(to_char(first_time, 'hh24'),'02',1,0)) as "h02",
        SUM(decode(to_char(first_time, 'hh24'),'03',1,0)) as "h03",
        SUM(decode(to_char(first_time, 'hh24'),'04',1,0)) as "h04",
        SUM(decode(to_char(first_time, 'hh24'),'05',1,0)) as "h05",
        SUM(decode(to_char(first_time, 'hh24'),'06',1,0)) as "h06",
        SUM(decode(to_char(first_time, 'hh24'),'07',1,0)) as "h07",
        SUM(decode(to_char(first_time, 'hh24'),'08',1,0)) as "h08",
        SUM(decode(to_char(first_time, 'hh24'),'09',1,0)) as "h09",
        SUM(decode(to_char(first_time, 'hh24'),'10',1,0)) as "h10",
        SUM(decode(to_char(first_time, 'hh24'),'11',1,0)) as "h11",
        SUM(decode(to_char(first_time, 'hh24'),'12',1,0)) as "h12",
        SUM(decode(to_char(first_time, 'hh24'),'13',1,0)) as "h13",
        SUM(decode(to_char(first_time, 'hh24'),'14',1,0)) as "h14",
        SUM(decode(to_char(first_time, 'hh24'),'15',1,0)) as "h15",
        SUM(decode(to_char(first_time, 'hh24'),'16',1,0)) as "h16",
        SUM(decode(to_char(first_time, 'hh24'),'17',1,0)) as "h17",
        SUM(decode(to_char(first_time, 'hh24'),'18',1,0)) as "h18",
        SUM(decode(to_char(first_time, 'hh24'),'19',1,0)) as "h19",
        SUM(decode(to_char(first_time, 'hh24'),'20',1,0)) as "h20",
        SUM(decode(to_char(first_time, 'hh24'),'21',1,0)) as "h21",
        SUM(decode(to_char(first_time, 'hh24'),'22',1,0)) as "h22",
        SUM(decode(to_char(first_time, 'hh24'),'23',1,0)) as "h23"
FROM    V$log_history
group by trunc(first_time), to_char(first_time, 'Dy')
Order by 1;

clear breaks
timing stop 'Redo Switch Rate';

set heading off;
prompt *********************************************************************
prompt ****     Redolog Daily and Hourly volume calculated              ****
prompt *********************************************************************

timing start Redovol;

--##########################################################################
--##  PL/SQL used here to gather and display average redo volumes         ##
--##########################################################################

set serveroutput on;
set feedback off
declare

v_log    number;
v_days   number;
v_logsz  number;
v_adsw   number;
V_advol  number;
v_ahsw   number;
v_ahvol  number;


begin

select count(first_time) into v_log from v$log_history;
select count(distinct(to_char(first_time,'dd-mon-rrrr'))) into v_days from v$log_history;
select max(bytes)/1024/1024 into v_logsz from v$log;

v_adsw := round(v_log / v_days);
v_advol := round(v_adsw * v_logsz);
v_ahsw := round(v_adsw / 24);
v_ahvol := round((v_adsw / 24 )) * v_logsz;

dbms_output.put_line('');
dbms_output.put ('Total Switches' || ''||v_log||'  ==>  ');
dbms_output.put ('Total Days' || ''|| v_days||'  ==>  ');
dbms_output.put_line ('Redo Size' || '' || v_logsz);
dbms_output.put ('Avg Daily Switches' || '' || v_adsw||'  ==>  ');
dbms_output.put_line ('Avg Daily Volume in Meg' || '' || v_advol);
dbms_output.put ('Avg Hourly Switches' || '' || v_ahsw||'  ==>  ');
dbms_output.put_line ('Avg Hourly Volume in Meg' || '' || v_ahvol);
dbms_output.put_line('');


end;

/

timing stop Redovol;
set heading off;
PROMPT *********************************************************************
PROMPT ****  The above is to help you compute the amount of disk space  ****
PROMPT ****  needed for the SharePlex queues. Use the below formula.    ****
PROMPT ****                                                             ****
PROMPT ****  [size of a redo log] x [# of log switches in 1 hour]       ****
PROMPT ****  x 1/3  x [number of hours downtime]                        ****
PROMPT ****  = amount of disk space needed for the queues on each system****
PROMPT ****                                                             ****
PROMPT ****  For example,                                               ****
PROMPT ****  if you expect to recover from 8 hours of downtime,         ****
PROMPT ****  and your redo logs are 500 MB in size                      ****
PROMPT ****  and switch five times an hour,                             ****
PROMPT ****  then you could need 6.5 GB of                              ****
PROMPT ****  space on both the source and target machines               ****
PROMPT ****  for the SharePlex queues.                                  ****
PROMPT ****  [500 MB redo log] x [5 switches/hour] x [1/3] x [8 hours]  ****
PROMPT ****  = 6.5 GB disk space                                        ****
PROMPT *********************************************************************
PROMPT
PROMPT
PROMPT
PROMPT
PROMPT
PROMPT *********************************************************************
PROMPT ****     CLUSTERED TABLES                                        ****
PROMPT ****     NOT SUPPORTED                                           ****
PROMPT *********************************************************************
timing start Cluster;
set heading on;
SELECT owner, cluster_name, cluster_type, single_table
FROM   dba_clusters
WHERE  owner NOT IN &user_exclusion
ORDER BY owner, cluster_name;
timing stop Cluster;

set heading off;
PROMPT
PROMPT
PROMPT *********************************************************************
PROMPT ****     Tablespaces with Transparent Data Encryption            ****
PROMPT ****     Prior to SP 8.0: NOT SUPPORTED                          ****
PROMPT *********************************************************************
timing start TS_TDE;
set heading on;

SELECT t.name
FROM   v$encrypted_tablespaces e, sys.ts$ t
WHERE  e.ts# = t.ts#
AND    e.encryptedts = 'YES';
timing stop TS_TDE;

set heading off;

PROMPT
PROMPT
PROMPT *********************************************************************
PROMPT ****     Compressed tables, partitions or subpartitions          ****
PROMPT ****     Supported only for Oracle 11gR2+ and SP 7.6+            ****
PROMPT ****     If that not applies and partitioned table, then         ****
PROMPT ****     doublecheck if partitions are actually compressed       ****
PROMPT ****     - If yes: NOT SUPPORTED                                 ****
PROMPT ****     - If no:  Check to just change default compression      ****
PROMPT ****     -         attribute of the table                        ****
PROMPT *********************************************************************
timing start compress_table;
set heading on;
SELECT owner, table_name,compression,compress_for, NULL AS partition_name, NULL AS subpartition_name,
  CASE WHEN compress_for IN ('BASIC','DIRECT LOAD ONLY') THEN 'Yes (for 11gR2+ and SP7.6+)'
       WHEN compress_for IN ('OLTP','FOR ALL OPERATIONS') THEN 'Yes (for 11gR2+ and SP7.6+)'
       WHEN compress_for IN ('QUERY LOW','QUERY HIGH','ARCHIVE LOW','ARCHIVE HIGH') THEN 'No (Exadata HCC)'
       ELSE 'Please doublecheck! (Unknown compression type: ' || compress_for || ')'
  END AS "Supported?"
FROM dba_tables
WHERE compression = 'ENABLED'
AND   owner NOT IN &user_exclusion
UNION
SELECT table_owner AS owner, table_name,compression,compress_for, partition_name, NULL AS subpartition_name,
  CASE WHEN compress_for IN ('BASIC','DIRECT LOAD ONLY') THEN 'Yes (for 11gR2+ and SP7.6+)'
       WHEN compress_for IN ('OLTP','FOR ALL OPERATIONS') THEN 'Yes (for 11gR2+ and SP7.6+)'
       WHEN compress_for IN ('QUERY LOW','QUERY HIGH','ARCHIVE LOW','ARCHIVE HIGH') THEN 'No (Exadata HCC)'
       ELSE 'Please doublecheck! (Unknown compression type: ' || compress_for || ')'
  END AS "Supported?"
FROM dba_tab_partitions
WHERE compression = 'ENABLED'
AND   table_owner NOT IN &user_exclusion
UNION
SELECT table_owner AS owner, table_name,compression,compress_for, partition_name, subpartition_name,
  CASE WHEN compress_for IN ('BASIC','DIRECT LOAD ONLY') THEN 'Yes (for 11gR2+ and SP7.6+)'
       WHEN compress_for IN ('OLTP','FOR ALL OPERATIONS') THEN 'Yes (for 11gR2+ and SP7.6+)'
       WHEN compress_for IN ('QUERY LOW','QUERY HIGH','ARCHIVE LOW','ARCHIVE HIGH') THEN 'No (Exadata HCC)'
       ELSE 'Please doublecheck! (Unknown compression type: ' || compress_for || ')'
  END AS "Supported?"
FROM dba_tab_subpartitions
WHERE compression = 'ENABLED'
AND   table_owner NOT IN &user_exclusion
ORDER BY owner, table_name, partition_name, subpartition_name;


set heading off;
PROMPT
PROMPT
PROMPT *********************************************************************
PROMPT ****     Columns with Transparent Data Encryption                ****
PROMPT ****     Prior to SP 7.6: NOT SUPPORTED                          ****
PROMPT ****     Starting with SP 7.6: Supported for some datatypes      ****
PROMPT ****     Not supported for Shareplex key columns!                ****
PROMPT ****     Column on target database has to be nullable!           ****
PROMPT *********************************************************************
timing start TDE;
set heading on;
COLUMN owner FORMAT A20
COLUMN table_name FORMAT A30
COLUMN column_name FORMAT A20
COLUMN "Datatype supported?" FORMAT A30
COLUMN "Part ok Shareplex Key?" FORMAT A40
COLUMN nullable FORMAT A8
SELECT tc.owner, tc.table_name, tc.column_name,
  CASE WHEN tc.data_type IN ('CHAR', 'NCHAR', 'VARCHAR2', 'NVARCHAR2', 'NUMBER', 'DATE', 'RAW') THEN 'Yes with SP7.6+ ('
       ELSE 'No ('
  END || data_type || ')' AS "Datatype supported?",
  CASE WHEN c.constraint_name IS NULL THEN 'No PK (check for Shareplex key!)'
       WHEN c.constraint_name IS NOT NULL AND cc.column_name IS NULL THEN 'Yes'
           ELSE 'No (different Shareplex key?)'
  END AS "Outside of Primary Key?" ,
  tc.nullable
FROM   dba_encrypted_columns ec
       INNER JOIN dba_tab_cols tc ON (tc.owner = ec.owner AND tc.table_name = ec.table_name AND tc.column_name = ec.column_name)
       LEFT OUTER JOIN dba_constraints c ON (tc.owner = c.owner AND tc.table_name = c.table_name AND c.constraint_type = 'P')
       LEFT OUTER JOIN dba_cons_columns cc ON (c.owner = cc.owner AND c.constraint_name = cc.constraint_name AND tc.column_name = cc.column_name)
WHERE  ec.owner NOT IN &user_exclusion
ORDER BY SUBSTR("Datatype supported?",1,1) ASC,
         SUBSTR("Outside of Primary Key?",1,1) ASC,
                 nullable ASC,
                 owner, table_name, column_name;

timing stop TDE;

set heading off;
PROMPT
PROMPT
PROMPT *********************************************************************
PROMPT ****     SecuredFile LOBs                                        ****
PROMPT ****     Prior to SP 7.6: Not supported                          ****
PROMPT ****     SP 7.6 or higher: SecureFile LOBs with LOGGING and      ****
PROMPT ****     without encryption, compression                         ****
PROMPT ****     and dedup are supported                                 ****
PROMPT *********************************************************************

COLUMN owner FORMAT A20
COLUMN table_name FORMAT A30
COLUMN column_name FORMAT A20
COLUMN partition_name FORMAT A20
COLUMN subpartition_name FORMAT A20
COLUMN "ENC,COMPR,DEDUP,LOGGING" FORMAT A25
SELECT owner, table_name, column_name, partition_name, subpartition_name,
       encrypt || ',' || compression  || ',' || deduplication  || ',' || logging AS "ENC,COMPR,DEDUP,LOGGING",
       CASE
             WHEN encrypt IN ('NO','NONE') AND compression IN ('NO','NONE') AND deduplication IN ('NO','NONE') AND logging IN ('YES','NONE') THEN 'Yes (with SP7.6+)'
                 ELSE 'No'
           END AS "Supported?"
FROM (
  SELECT owner, table_name, column_name, NULL AS partition_name, NULL AS subpartition_name, encrypt, compression, deduplication, logging
  FROM   dba_lobs
  WHERE  securefile='YES'
  AND    owner NOT IN &user_exclusion
  UNION
  SELECT table_owner, table_name, column_name, partition_name, NULL AS subpartition_name, encrypt, compression, deduplication, logging
  FROM   dba_lob_partitions
  WHERE  securefile='YES'
  AND    table_owner NOT IN &user_exclusion
  UNION
  SELECT table_owner, table_name, column_name, lob_partition_name AS partition_name, subpartition_name, encrypt, compression, deduplication, logging
  FROM   dba_lob_subpartitions
  WHERE  securefile='YES'
  AND    table_owner NOT IN &user_exclusion)
ORDER BY owner, table_name, column_name, partition_name, subpartition_name;
timing stop 'Lobdef';

set heading off;
PROMPT
PROMPT
PROMPT
PROMPT
PROMPT
prompt *********************************************************************
prompt ****     NOTE                                                    ****
prompt ****     THE Next 2 sections should be looked at                 ****
prompt ****     Check NonBasic Datatypes for any unsopported data types ****
prompt ****     Check if the Schema owners of of the nested objects are ****
prompt ****     the same on source and target.                          ****
prompt *********************************************************************
PROMPT
PROMPT
set heading off;
prompt *********************************************************************
prompt ****     List of non-basic Data Types Contained in the Database  ****
prompt ****     Check NonBasic Datatypes for any unsopported data types ****
prompt *********************************************************************
timing start 'NonBasic Datatypes';

set heading on;
select a.owner, a.table_name, a.column_name,a.data_type from dba_tab_columns a, dba_objects b
where data_type not in ('VARCHAR','VARCHAR2','DATE','NUMBER','NVARCHAR2','TIMESTAMP%','LOB','BLOB','CLOB','LONG','LONG RAW','CHAR','ROWID','RAW','FLOAT','NCLOB') and
a.owner not in &user_exclusion
and a.table_name = b.object_name
and b.object_type = 'TABLE'
order by a.owner;
timing stop 'NonBasic Datatypes';

set heading off;
prompt *********************************************************************
prompt ****      List of Nested Arrays                                  ****
prompt ****      For UDTs Only                                          ****
prompt ****      Check if the Schema owners of of the nested            ****
prompt ****      objects are the same on source and target.             ****
prompt *********************************************************************
timing start 'NestArray';

Set heading on;
select b.owner,b.attr_type_name as "Nested Array", b.type_name as "Nested In Type", b.attr_name as "Nested in Column"
from dba_type_attrs b
where b.attr_type_name in (select a.type_name from dba_types a where a.owner
not in &user_exclusion and typecode = 'COLLECTION')
order by b.owner;
timing stop 'NestArray';

set heading off;
PROMPT
PROMPT
PROMPT
PROMPT
PROMPT
prompt *********************************************************************
prompt ****     NOTE                                                    ****
prompt ****     THE REMAINING OUTPUT IS IMFORMATIONAL AND               ****
prompt ****     USED FOR IMPLEMENTATION AND PLANNING PURPOSES           ****
prompt ****     ESMs may ignore                                         ****
prompt *********************************************************************
PROMPT
PROMPT
PROMPT
PROMPT
PROMPT
set heading off;
prompt *********************************************************************
prompt ****     List of Tables with more than 254 columns               ****
prompt *********************************************************************
timing start '254ormore';

set heading on;
column owner format a30
column table_name format a30
column numcols format 999G999G999

select owner,table_name,count(table_name) as "NumCols"
from dba_tab_columns where owner not in &user_exclusion
group by owner,table_name having count(table_name) > 254
order by owner;
timing stop '254ormore';

set heading off;
prompt *********************************************************************
prompt ****     List of Tables that contain LONG data types             ****
prompt *********************************************************************
timing start 'Long Lob';

set heading on;
column column_name format a30
column table_name format A30
column data_type format a30
select owner,table_name,column_name,data_type from dba_tab_columns where data_type in ('LONG')
and owner not in &user_exclusion
order by owner;
timing stop 'Long Lob';

prompt *********************************************************************
prompt ****     Listing of Index Organized Tables                       ****
prompt *********************************************************************
timing start IOTs;

set heading on;
select owner,table_name,iot_type
from dba_tables
where iot_type = 'IOT'
and owner not in &user_exclusion
order by owner;
timing stop IOTs;

set heading off;
prompt *********************************************************************
prompt ****     Listing of Bitmap Indexes                               ****
prompt *********************************************************************
timing start Bitmaps;

set heading on;
select owner,index_name,table_owner,table_name
from dba_indexes where index_type = 'BITMAP'
order by owner;
timing stop Bitmaps;

set heading off;
prompt *********************************************************************
prompt ****     List of Data Types Contained in the Database            ****
prompt *********************************************************************
timing start Datatypes;

set heading on;
select distinct data_type from dba_tab_columns
where owner not in &user_exclusion;
timing stop Datatypes;

set heading off;
prompt *********************************************************************
prompt ****     List of Tables with size > 100 MB                       ****
prompt *********************************************************************
timing start Largetable;

set heading on;
column MBYTE format 999G999G990
column PCT_FREE format 999
column PCT_USED format 999
select t.owner, t.table_name, t.tablespace_name, s.bytes/1024/1024 MBYTE, t.pct_free, t.pct_used, t.num_rows, t.chain_cnt, t.blocks
from dba_tables t, dba_segments s
where t.owner = s.owner
and t.table_name = s.segment_name
and t.owner not in &user_exclusion
and s.bytes > 100000000
order by t.owner, t.table_name;
timing stop Largetable;


set heading off;
prompt *********************************************************************
prompt ****     list of tables not analysed for the last 30 days        ****
prompt *********************************************************************
timing start Analyzed;

set heading on;
select owner, table_name, to_char(last_analyzed,'DD-MON-RR') as "Analyzed"
from dba_tables
where last_analyzed is not NULL
and last_analyzed < sysdate-30
and owner not in &user_exclusion
order by 1,2,3;
timing stop Analyzed;

set heading off;
prompt *********************************************************************
prompt ****     List of Tables Created in the last 60 Days              ****
prompt *********************************************************************
timing start Created;

set heading on;
col "Table_Nm" for a30;
select owner, substr(object_name,1,30) as "Table_Nm",created
from dba_objects where object_type = 'TABLE'
and created > sysdate-60
and owner not in &user_exclusion
order by 1,2;

timing stop Created;

set heading off;
prompt *********************************************************************
prompt ****     Count of triggers by Row Level and then Statement Level ****
prompt *********************************************************************
timing start Triggers;

set heading on;
select count(trigger_type) as "Row Level"
from dba_triggers
where trigger_type like '%ROW%'
and owner not in &user_exclusion;

set heading off;
prompt *** Statement Level ****
set heading on;
select owner,trigger_name,trigger_type,table_owner,table_name
from dba_triggers
where trigger_type not like '%ROW%'
and owner not in &user_exclusion
order by owner;

timing stop Triggers;

set heading off;
prompt *********************************************************************
prompt ****     List Constraints with On-Delete Cascades                ****
prompt *********************************************************************
timing start OnDelCasc;

set heading on;

select owner,constraint_name,table_name from dba_constraints
where delete_rule = 'CASCADE'
and owner not in &user_exclusion
order by owner;
timing stop OnDelCasc;




set heading off;

--##########################################################################
--##                                     END of PL/SQL routine            ##
--##########################################################################
set heading on;


spool off;

prompt *********************************************************************
prompt ****     &dbname..lst has been generated.                        ****
prompt ****     Please send it to Quest Software                        ****
prompt *********************************************************************


set verify on;


Lock/unlock statistics of a table

$
0
0
There are cases where we do not need to update the statistics of the table so that oracle plan does not impact.
In those cases, we can lock the statistics of the table object using below procedure.


exec dbms_stats.lock_table_stats('AR','AR_IREC_USER_ACCT_SITES_ALL');


You can always unlock the statistics as below.

exec dbms_stats.unlock_table_stats('AR','AR_IREC_USER_ACCT_SITES_ALL');

To find the locked statistics table list, you will need to query dba_tab_statistics.

select table_name, stattype_locked
    from dba_tab_statistics
    where stattype_locked is not null;

SYSADMIN login taking long time to log in

$
0
0
Sometimes, SYSADMIN login in particular instance will take long time to log in as it will have open workflow notifications waiting to be closed.

We cannot close those open workflow notifications using front end if the open notification are huge.

UPDATE wf_notifications set status='CLOSED' , mail_status='SENT', end_date=sysdate where recipeint_role='SYSADMIN';

commit;

This will allow you to close the open notifications, and will resolve the slow login using SYSADMIN user.
Viewing all 1640 articles
Browse latest View live