Reorg tables&indexes in EBS and Normal DB

Case:

Usually in OLTP environment like EBS Applications, tables are often get fragmented due to multiple DML activities that happens.Fragmented tables cause queries on those tables to slow down. It is very important to de-fragment this table and to reclaim the fragmented space from these objects.

For EBS we have also seen  that usually gathered statistics, indexing and proper SQL tuning is plenty to improve and maintain acceptable performance but sometime it is required to reorg the table.

One primary cause of fragmentation is that when you run delete command on the tables it delete the rows but doesn’t frees up the memory and also do not changes the high water mark.

We have also seen that this requirement for doing reorg is more required in Demantra applications and since Demantra is both OLTP and data warehouse the applications we  must tune accordingly so that query run time can be optimum.

Although this article focus on the EBS/Demantra application tables but it is true for all oracle databases.

WHAT CAUSES FRAGMENTATION

As DML activity happens in the database, it is possible for there to be discontinuous chunks, or fragments of unused space within the tablespace and fragmentation within the table rows.

When you insert  or update row in table

As rows are added to tables, the table expands into unused space within the space. It will naturally fragment as discontiguous data blocks are fetched to receive new rows. Updating table records may also cause row chaining if the updated row can’t fit into same data block.

When you delete rows from table

At deletion, a table may coalesce extents, releasing unused space back into the tablespace. A lot of deletes leaves high-water mark behind at a high value. It will cause slower full-table-scan performance since Oracle must read to the high water mark.

WHY FRAGMENTATION IS BAD FOR DATABASE

Fragmentation can make a database run inefficiently.

a) Negative Performance impact – SQL  statements that performs full-scan and large index range scans may run more slowly in a fragmented table. When rows are not stored contiguously, or if rows are split onto more than one block, performance decreases because these rows require additional block accesses.

b) Wasted Disk Space – It means you have space in your disk which your database can not use.

 

REORG PROCESS

The main goal of table reorganization is to reduce IO when accessing the big database tables.

1. Reorders the table data according to the primary key index.
2. Column reordering to push columns that have no data, nulls, to the end of the table row

The column reordering can be very useful for tables that have 300+ columns many of the columns are null. When the null columns are pushed to the end of the row, the read operation becomes streamlined thus increasing performance.

We usually follow below process for counter table fragmentation. We have also mentioned some good scripts related to data fragmentation at that end of this article.

 

STEP 1) GATHER STATISTICS

First you need to check exact difference in table actual size (dba_segments) and stats size (dba_tables). The difference between these value will report actual fragmentation to us. This means we need to have updated stats in the dba_tables for the tables.

To understand how we collect latest statistics in EBS, please see this earlier article Gather Statistics in R12 (and 11i)

 

STEP 2) CHECK FOR FRAGMENTATION

Execute Script 1 provided below to find the fragmented tables

It is important that you execute step 1 for gathering statistics first before you run this script or else result will be inaccurate.

This script will show you tables which are more fragmented. You can identify tables which are frequently used in your problematic long running queries and target those for reorg process.

Please note that it is not always a good idea to reorganize a partitioned table. Partitioning of data is considered an efficient data organization mechanism which boosts query performance.

 

STEP 3) REORG THE IDENTIFIED FRAGMENTED TABLES

We have multiple options to reorganize fragmented tables:

 METHOD 1. Alter table move (to another tablespace, or same tablespace) and rebuild indexes:-

 METHOD 2. Export and import the table

 METHOD 3. Shrink command . (applicable for tables which are tablespace with auto segment space management)

 

Method 1 is most popular and is described below:

 

METHOD 1. Alter table move

 

A) Check Table size and Fragmentation in table

It is good idea to check and record what is the current size and fragmentation in table using script 1 provided below

 

B) Collect indexes details

Execute below command to find the indexes details

select index_name,status from dba_indexes where table_name like '&table_name';

 

C) Move table in to same or new tablespace

For moving into same tablespace execute below:

alter table <table_name> move;

For moving into another tablespace, first find Current size of you table from dba_segments and check if any other tablespace has free space available

alter table <table_name> enable row movement;

alter table <table_name> move tablespace <new_tablespace_name>;

After that move back the table to original tablespace

alter table table_name move tablespace old_tablespace_name;

 

D) Rebuild all indexes

We need to rebuild all the indexes as move command will make all the index unusable. Run the alter index command one by one for each index.

select status,index_name from dba_indexes where table_name = '&table_name';

alter index <INDEX_NAME> rebuild online; 

select status,index_name from dba_indexes where table_name = '&table_name';

 

E) Gather table stats

For EBS application’s datbase we use FND_STATS package

exec fnd_stats.gather_table_stats('&owner_name','&table_name');

For normal oracle database, we use DBMS_STATS

exec dbms_stats.gather_table_stats('&owner_name','&table_name');

 

F) Check Table size and Fragmentation in table

Now again check table size using script 1.

In our case we were able to reduce the table size from 4 GB to 0.15 GB as the table was highly fragmented.

 It is also good idea to see if there are any new invalid objects in database and run utlrp.sql to compile objects.

 

IMPORTANT SCRIPTS

Some good scripts related to re-org:

Script 1: To locate highly fragmented tables

select

 table_name,round(((blocks*8)/1024/1024),2) "size (gb)" ,

 round(((num_rows*avg_row_len/1024))/1024/1024,2) "actual_data (gb)",

 round((((blocks*8)) - ((num_rows*avg_row_len/1024)))/1024/1024,2) "wasted_space (gb)",

 round(((((blocks*8)-(num_rows*avg_row_len/1024))/(blocks*8))*100 -10),2) "reclaimable space %",

 partitioned

from

 dba_tables

where

 (round((blocks*8),2) > round((num_rows*avg_row_len/1024),2))

order by 4 desc;

 

Script 2: To find how are data blocks used for a specific table

set serveroutput on

 

declare

 v_unformatted_blocks number;

 v_unformatted_bytes number;

 v_fs1_blocks number;

 v_fs1_bytes number;

 v_fs2_blocks number;

 v_fs2_bytes number;

 v_fs3_blocks number;

 v_fs3_bytes number;

 v_fs4_blocks number;

 v_fs4_bytes number;

 v_full_blocks number;

 v_full_bytes number;

 begin

 dbms_space.space_usage (

 'APPLSYS',

 'FND_CONCURRENT_REQUESTS',

 'TABLE',

 v_unformatted_blocks,

 v_unformatted_bytes,

 v_fs1_blocks,

 v_fs1_bytes,

 v_fs2_blocks,

 v_fs2_bytes,

 v_fs3_blocks,

 v_fs3_bytes,

 v_fs4_blocks,

 v_fs4_bytes,

 v_full_blocks,

 v_full_bytes);

 dbms_output.put_line('Unformatted Blocks = '||v_unformatted_blocks);

 dbms_output.put_line('Blocks with 00-25% free space = '||v_fs1_blocks);

 dbms_output.put_line('Blocks with 26-50% free space = '||v_fs2_blocks);

 dbms_output.put_line('Blocks with 51-75% free space = '||v_fs3_blocks);

 dbms_output.put_line('Blocks with 76-100% free space = '||v_fs4_blocks);

 dbms_output.put_line('Full Blocks = '||v_full_blocks);

 

end;

 /

 

This will give output like below:

Unformatted Blocks = 64

 Blocks with 00-25% free space = 0

 Blocks with 26-50% free space = 516

 Blocks with 51-75% free space = 282

 Blocks with 76-100% free space = 282

 Full Blocks = 10993

 PL/SQL procedure successfully completed.

 

Note

How to Deallocate Unused Space from a Table, Index or Cluster. (Doc ID 115586.1)
How to Determine Real Space used by a Table (Below the High Water Mark) (Doc ID 77635.1)
Reclaiming Unused Space in an E-Business Suite Instance Tablespace (Doc ID 303709.1)
How to Re-Organize a Table Online (Doc ID 177407.1)
Reorg Failiure : Demantra Reorg Failing On SALES_DATA (Doc ID 2209718.1)Demantra Table Reorganization, Fragmentation, Null Columns, Primary Key, Editioning, Cluster Factor, PCT Fee, Freelist, Initrans, Automatic Segment Management (ASM), Blocksize…. (Doc ID 1990353.1)
SEGMENT SHRINK and Details. (Doc ID 242090.1)

 

  

Create DB SYSTEM (OCI)

 

Using the Console

To create a DB system

Open the navigation menu. Under Oracle Database, click Bare Metal, VM, and Exadata.

Click Create DB System.

On the Create DB System page, provide the basic information for the DB system:


Select a compartment: By default, the DB system is created in your current compartment and you can use the network resources in that compartment.

Name your DB system: A non-unique, display name for the DB system. An Oracle Cloud Identifier (OCID) uniquely identifies the DB system.

Select an availability domain: The availability domain  in which the DB system resides.

Select a shape type: The shape type you select sets the default shape and filters the shape options in the next field.

Select a shape: The shape determines the type of DB system created and the resources allocated to the system. To specify a shape other than the default, click Change Shape, and select an available shape from the list.

Configure the DB system: Specify the following:


Total node count: The number of nodes in the DB system, which depends on the shape you select. For virtual machine DB systems, you can specify either one or two nodes, except for VM.Standard2.1 and VM.Standard1.1, which are single-node DB systems.

Oracle Database software edition: The database edition supported by the DB system. For bare metal systems, you can mix supported database releases on the DB system to include older database versions, but not editions. The database edition cannot be changed and applies to all the databases in this DB system. Virtual machine systems support only one database.

CPU core count: Displays only for bare metal DB systems to allow you to specify the number of CPU cores for the system. (Virtual machine DB system shapes have a fixed number of CPU cores.) The text below the field indicates the acceptable values for that shape. For a multi-node DB system, the core count is evenly divided across the nodes.


 Note


After you provision the DB system, you can increase the CPU cores to accommodate increased demand. On a bare metal DB system, you scale the CPU cores directly. For virtual machine DB systems, you change the number of CPU cores by changing the shape.

Choose Storage Management Software: 1-node virtual machine DB systems only. Select Oracle Grid Infrastructure to use Oracle Automatic Storage Management (recommended for production workloads). Select Logical Volume Manager to quickly provision your DB system using Logical Volume Manager storage management software. Note that the Available storage (GB) value you specify during provisioning determines the maximum total storage available through scaling. The total storage available for each choice is detailed in the Storage Scaling Considerations for Virtual Machine Databases Using Fast Provisioning topic.


See Fast Provisioning Option for 1-node Virtual Machine DB Systems for more information about this feature.


Configure storage: Specify the following:


Available storage (GB): Virtual machine only. The amount of Block Storage in GB to allocate to the virtual machine DB system. Available storage can be scaled up or down as needed after provisioning your DB system.

Total storage (GB): Virtual machine only. The total Block Storage in GB used by the virtual machine DB system. The amount of available storage you select determines this value. Oracle charges for the total storage used.

Cluster name: (Optional) A unique cluster name for a multi-node DB system. The name must begin with a letter and contain only letters (a-z and A-Z), numbers (0-9) and hyphens (-). The cluster name can be no longer than 11 characters and is not case sensitive.

Data storage percentage: Bare metal only. The percentage (40% or 80%) assigned to DATA storage (user data and database files). The remaining percentage is assigned to RECO storage (database redo logs, archive logs, and recovery manager backups).

Add public SSH keys: The public key portion of each key pair you want to use for SSH access to the DB system. You can browse or drag and drop .pub files, or paste in individual public keys. To paste multiple keys, click + Another SSH Key, and supply a single key for each entry.

Choose a license type: The type of license you want to use for the DB system. Your choice affects metering for billing.


License Included means the cost of this Oracle Cloud Infrastructure Database service resource will include both the Oracle Database software licenses and the service.

Bring Your Own License (BYOL) means you will use your organization's Oracle Database software licenses for this Oracle Cloud Infrastructure Database service resource. See Bring Your Own License for more information.

Specify the network information:


Virtual cloud network: The VCN in which to create the DB system. Click Change Compartment to select a VCN in a different compartment.

Client Subnet: The subnet to which the DB system should attach. For 1- and 2-node RAC DB systems:  Do not use a subnet that overlaps with 192.168.16.16/28, which is used by the Oracle Clusterware private interconnect on the database instance. Specifying an overlapping subnet will cause the private interconnect to malfunction.

Click Change Compartment to select a subnet in a different compartment.


Network Security Groups: Optionally, you can specify one or more network security groups (NSGs) for your DB system. NSGs function as virtual firewalls, allowing you to apply a set of ingress and egress security rules to your DB system. A maximum of five NSGs can be specified. For more information, see Network Security Groups and Network Setup for DB Systems.


Note that if you choose a subnet with a security list, the security rules for the DB system will be a union of the rules in the security list and the NSGs.


Hostname prefix: Your choice of host name for the bare metal or virtual machine DB system. The host name must begin with an alphabetic character, and can contain only alphanumeric characters and hyphens (-). The maximum number of characters allowed for bare metal and virtual machine DB systems is 16.


 Important


The host name must be unique within the subnet. If it is not unique, the DB system will fail to provision.

Host domain name: The domain name for the DB system. If the selected subnet uses the Oracle-provided Internet and VCN Resolver for DNS name resolution, then this field displays the domain name for the subnet and it can't be changed. Otherwise, you can provide your choice of a domain name. Hyphens (-) are not permitted.

Host and domain URL: Combines the host and domain names to display the fully qualified domain name (FQDN) for the database. The maximum length is 64 characters.

Click Show Advanced Options to specify advanced options for the DB system:


Disk redundancy: For bare metal systems only. The type of redundancy configured for the DB system.

Normal is 2-way mirroring, recommended for test and development systems.

High is 3-way mirroring, recommended for production systems.

Fault domain: The fault domain(s) in which the DB system resides. You can choose which fault domain to use for your DB system. For two-node Oracle RAC DB systems, you can specify which two fault domains to use. Oracle recommends that you place each node of a two-node Oracle RAC DB system in a different fault domain. For more information on fault domains, see About Regions and Availability Domains.

Time zone: The default time zone for the DB system is UTC, but you can specify a different time zone. The time zone options are those supported in both the Java.util.TimeZone class and the Oracle Linux operating system. For more information, see DB System Time Zone.


 Tip


If you want to set a time zone other than UTC or the browser-detected time zone, and if you do not see the time zone you want, try selecting "Miscellaneous" in the Region or country list.


Tags: If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you are not sure if you should apply tags, then skip this option (you can apply tags later) or ask your administrator.

After you complete the network configuration and specify any advanced options, click Next.

Provide information for the initial database:


Database name: The name for the database. The database name must begin with an alphabetic character and can contain a maximum of eight alphanumeric characters. Special characters are not permitted.

Database image: This controls the version of the initial database created on the DB system. By default, the latest available Oracle Database version is selected. You can also choose an older Oracle Database version, or choose a customized database software image that you have previously created in your current region with your choice of updates and one-off (interim) patches. See Oracle Database Software Images for information on creating and working with database software images.


To use an older Oracle-published software image:


Click Change Database Image.

In the Select a Database Software Image dialog, select Oracle-published Database Software Images.

In the Oracle Database Version list, check the version you wish to use to provision the initial database in your DB system. If you are launching a DB system with a virtual machine shape, you have option of selecting an older database version.


Display all available versions: Use this switch to include older database updates in the list of database version choices. When the switch is activated, you will see all available PSUs and RUs. The most recent release for each major version is indicated with "(latest)". See Availability of Older Database Versions for Virtual Machine DB Systems for more information.


 Note


Preview software versions: Versions flagged as "Preview" are for testing and subject to some restrictions. See Oracle Database Preview Version Availability for more information.


Click Select.

To use a user-created database software image:


Click Change Database Image.

In the Select a Database Software Image dialog, select Custom Database Software Images.

Select the compartment that contains your database software image.

Select the Oracle Database version that your database software image uses.

A list of database software images is displayed for your chosen Oracle Database version. Check the box beside the display name of the image you want to use.

After the DB system is active, you can create additional databases for bare metal systems. You can mix database versions on the DB system, but not editions. Virtual machine DB systems are limited to a single database.


PDB name: Not applicable to Oracle Database 11g (11.2.0.4). The name of the pluggable database. The PDB name must begin with an alphabetic character, and can contain a maximum of eight alphanumeric characters. The only special character permitted is the underscore ( _).

Create administrator credentials: A database administrator SYS user will be created with the password you supply.


Username: SYS

Password: Supply the password for this user. The password must meet the following criteria:


A strong password for SYS, SYSTEM, TDE wallet, and PDB Admin. The password must be 9 to 30 characters and contain at least two uppercase, two lowercase, two numeric, and two special characters. The special characters must be _, #, or -. The password must not contain the username (SYS, SYSTEM, and so on) or the word "oracle" either in forward or reversed order and regardless of casing.

Confirm password: Re-enter the SYS password you specified.

Select workload type: Choose the workload type that best suits your application:


Online Transactional Processing (OLTP) configures the database for a transactional workload, with a bias towards high volumes of random data access.

Decision Support System (DSS) configures the database for a decision support or data warehouse workload, with a bias towards large data scanning operations.

Configure database backups: Specify the settings for backing up the database to Object Storage:


Enable automatic backup: Check the check box to enable automatic incremental backups for this database. If you are creating a database in a security zone compartment, you must enable automatic backups.

Backup retention period: If you enable automatic backups, then you can choose one of the following preset retention periods: 7 days, 15 days, 30 days, 45 days, or 60 days. The default selection is 30 days.

Backup Scheduling: If you enable automatic backups, then you can choose a two-hour scheduling window to control when backup operations begin. If you do not specify a window, then the six-hour default window of 00:00 to 06:00 (in the time zone of the DB system's region) is used for your database. See Backup Scheduling for more information.

Click Show Advanced Options to specify advanced options for the initial database:


Character set: The character set for the database. The default is AL32UTF8.

National character set: The national character set for the database. The default is AL16UTF16.

Click Create DB System. The DB system appears in the list with a status of Provisioning. The DB system's icon changes from yellow to green (or red to indicate errors).


After the DB system's icon turns green, with a status of Available, you can click the highlighted DB system name to display details about the DB system. Note the IP addresses. You'll need the private or public IP address, depending on network configuration, to connect to the DB system.


Lavakumar

https://docs.cloud.oracle.com/en-us/iaas/Content/Database/Tasks/creatingDBsystem.htm



###############################################IMP POINT #############

console

under ORACLE DATABASE

SELECT BAREMATEL/VM/EXADATA

SELECT COMPARTMENT

SELECT SHAPE

UNDER SHAPE ONLY YOU CAN SET 

TOTAL NODE COUNT (single node have these VM STANDARD 2.1 and 1.1 )

ORACLE DB EDITION (on baremetal you select older vrsion RELEASE but not edition,DB edition cannot change its default,VM only support one DB)

CPU CORE COUNT (ONLY BARE METAL you specify cpu core,FOR VM you can only change Shape if you want change cpu core)

**AFTER CREATION DBSYSTEM WE CAN INCREASE/DECREASE DB SYSTEM **

Choose Storage Management:

You can select GRID ( recomended for PROD Workload and Logical Volume for fast DB system access)

Configure Storage have below options

Avilable Storage(only for VM)

Total storage(Only for VM and oracle charges for total storage)

clustername (to enter name not more than 11charcters)

Data Storage percentage(Only for Bare Metal,Userdata and Db files we can define this value,rest of all percentage goes to RECO)

Add Public SSH Keys:

Choose License Type: BYOL or select licence

Specify Network information:

VCN(we can select optionally different compartment vcn for multinode)

Network Security Group( for more ingress/exgress and security firewalls we can select max 5NSG)

Hostname prefix:The maximum number of characters allowed for bare metal and virtual machine DB systems is 16

Host domain name:by deafult subnet uses oracle provided internet and VCN resolver for DNS Name Resolution)

Host and domain URL: Combines the host and domain names to display the fully qualified domain name (FQDN) for the database. 

Disk redundancy: For bare metal systems only

Database name: The name for the database.

Database image: This controls the version of the initial database created on the DB system. By default, the latest available Oracle Database version is selected. You can also choose an older Oracle Database version

A strong password for SYS, SYSTEM, TDE wallet, and PDB Admin.

Enable automatic backup: Check the check box to enable automatic incremental backups for this database

Backup retention period: If you enable automatic backups, then you can choose one of the following preset retention periods: 7 days, 15 days, 30 days, 45 days, or 60 days. The default selection is 30 days.

Backup Scheduling: If you enable automatic backups, then you can choose a two-hour scheduling window to control when backup operations begin. If you do not specify a window, then the six-hour default window of 00:00 to 06:00 (in the time zone of the DB system's region) is used for your database.

Character set: The character set for the database. The default is AL32UTF8

Click Create DB System. The DB system appears in the list with a status of Provisioning. The DB system's icon changes from yellow to green (or red to indicate errors).



Note that if you choose a subnet with a security list, the security rules for the DB system will be a union of the rules in the security list and the NSGs.


DBCLI


DBCLI COMMAND

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

dbcli - It is a command line interface available on bare metal and virtual machine DB systems.

The database CLI commands must be run as the root user

dbcli is in the /opt/oracle/dcs/bin/ directory.

Oracle Database maintains logs of the dbcli command output in the dcscli.log and dcs-agent.log files in the /opt/oracle/dcs/log/ directory.

The database CLI commands use the following syntax:

EX::dbcli command [parameters]

command is a verb-object combination such as create-database.


parameters include additional options for the command. Most parameter names are preceded with two dashes, for example, --help. Abbreviated parameter names are preceded with one dash, for example, -h.


CLIADM

======

Use the cliadm update-dbcli command to update the database CLI with the latest new and updated commands.

Syntax:cliadm update-dbcli [-h] [-j]

h for help

j for json format

 Note:On RAC DB systems, execute the cliadm update-dbcli command on each node in the cluster.


AgentCommands
============
The following commands are available to manage agents: 

dbcli ping-agent
dbcli list-agentConfigParameters
dbcli update-agentConfigParameters

Clean/purge logs
================
The following commands are available to manage policies for automatic cleaning (purging) of logs.
dbcli create-autoLogCleanPolicy
dbcli list-autoLogCleanPolicy

Backup with dbcli
=================
Before you can back up a database by using the dbcli create-backup command, you'll need to:

Create a backup configuration by using the dbcli create-backupconfig command.
Associate the backup configuration with the database by using the dbcli update-database command.
After a database is associated with a backup configuration, you can use the dbcli create-backup command in a cron job to run backups automatically.

Commands for Backup:
dbcli create-backup
dbcli getstatus-backup
dbcli schedule-backup


Database Commands(The dbcli create-database command is available on bare metal DB systems only)
=================
The following commands are available to manage databases:

dbcli clone-database
dbcli create-database
dbcli delete-database
dbcli describe-database
dbcli list-databases
dbcli modify-database
dbcli recover-database
dbcli register-database
dbcli update-database

Objectstoreswift Commands
=========================
You can back up a database to an existing bucket in the Oracle Cloud Infrastructure Object Storage service by using the dbcli create-backup command, but first you'll need to:
Create an object store on the DB system, which contains the endpoint and credentials to access Object Storage, by using the dbcli create-objectstoreswift command.
Create a backup configuration that refers to the object store ID and the bucket name by using the dbcli create-backupconfig command.
Associate the backup configuration with the database by using the dbcli update-database command.
The following commands are available to manage object stores.

dbcli create-objectstoreswift
dbcli describe-objectstoreswift
dbcli list-objectstoreswifts



Objectstoreswift Commands
=========================
You can back up a database to an existing bucket in the Oracle Cloud Infrastructure Object Storage service by using the dbcli create-backup command, but first you'll need to:
Create an object store on the DB system, which contains the endpoint and credentials to access Object Storage, by using the dbcli create-objectstoreswift command.
Create a backup configuration that refers to the object store ID and the bucket name by using the dbcli create-backupconfig command.
Associate the backup configuration with the database by using the dbcli update-database command.
The following commands are available to manage object stores.

dbcli create-objectstoreswift
dbcli describe-objectstoreswift
dbcli list-objectstoreswifts


Rmanbackupreport Commands
=========================
The following commands are available to manage RMAN backup reports: 

dbcli create-rmanbackupreport
dbcli delete-rmanbackupreport
dbcli describe-rmanbackupreport
dbcli list-rmanbackupreports


Schedule Commands
=================
The following commands are available to manage schedules: 

dbcli describe-schedule
dbcli list-schedules
dbcli update-schedule
dbcli list-scheduledExecutions:Use the dbcli list-scheduledExecutions command to list scheduled executions.

Patching Commands:
==================
Use the dbcli update-server command to apply patches to the server components in the DB system. For more information about applying patches, see Patching a DB System.
dbcli update-server




 


TDE Commands
============
The following commands are available to manage TDE-related items (backup reports, keys, and wallets): 

dbcli list-tdebackupreports
dbcli update-tdekey
dbcli recover-tdewallet

Admin Commands
==============
The following commands are to perform administrative actions on the DB system:

dbadmcli manage diagcollect
dbadmcli power
dbadmcli power disk status
dbadmcli show controller
dbadmcli show disk
dbadmcli show diskgroup
dbadmcli show env_hw (environment type and hardware version) (environment type and hardware version)
dbadmcli show fs (file system details) (file system details)
dbadmcli show storage
dbadmcli stordiag


RDS -DBA TASKS

Doc:

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.Oracle.CommonDBATasks.html

 


Difference between apps and applsys

 Apps is centralised schema for all products in oracle.it has only access of views, synonyms...etc.

Applsys is only used to Handel FND and AOL other products base tables (ap,ar...etc)which required for selected responsibility is is valid or not after user clicked on particular responsibility.

Applsyspub/pub is dB user which is used to authenticate our Sso/anyuser when we login to EBS.

Guest user is dummy user which connects jdbc driver to connect users which doesn't have any roles.ex--istore,iprocurement..etc.


Role of APPLSYSPUB user/schema in Oracle Applications:

When we login to applications,initially oracle applications connect to public schema, APPLSYSPUB. This schema has sufficient privileges to perform the authentication of an Applications User (FND user), which includes running PL/SQL packages to verify the username/password combination and the privilege to record the success or failure of a login attempt.

  • The public ORACLE username and password that grants access to the Oracle E-Business Suite initial sign-on form. The default is APPLSYSPUB/PUB.
  • Once we change the APPLSYSPUB password must propagate the change to application tier configuration files. If the instance is Autoconfig enabled, must edit the CONTEXT file on each tier prior to running Autoconfig.
  • In the CONTEXT file, locate the autoconfig variable “s_gwyuid_pass” and set it to the new password, then run AutoConfig in each applications nodes.

When Autoconfig is not being used:

If you are not using Autoconfig you must manually edit the following configuration files :

1) FND_TOP/resource/appsweb.cfg
2) OA_HTML/bin/appsweb.cfg
3) FND_TOP/secure/HOSTNAME_DBNAME.dbc


To change password of APPLSYSPUB with FNDCPASS:

$FNDCPASS APPS/[apps_pass] 0 Y SYSTEM/[system_pass] ORACLE APPLSYSPUB [new_passs].


0 & Y are flags for FNDCPASS
0 is request id (request ID 0 is assigned to request ID's which are not submitted via Submit Concurrent Request Form)
'Y' indicates that this method is directly invoked from the command-line and not from the Submit Request Form.

  • All application tier processes (Apaches) must be restarted following the password change.


Role of GUEST user/schema in Oracle Applications:

  • GUEST is a dummy schema.
  • By default it has ORACLE as password.
  • GUEST/ORACLE password is present in DBC file at $FND_TOP/secure directory as well as at $FND_TOP/secure/SID_hostname directory.
  • If a user logs in without any role mappings, the user will get the Guest role, which has a default permission of "R".
  • GUEST user is used by JDBC Drivers and Oracle Self Service Web Applications like istore, irecruitment, iprocurement, ipayables, ireceivables etc to make initial Connection.

Role of APPLSYS & apps user/schema in Oracle Applications:

  • APPLSYS user is same as other oracle users like AP, AR, GL etc which hold their set of tables, views etc. In the same manner APPLSYS Account holds its set of tables like FND_USER and FND_APPLICATION, AD_APPLIED_PATCHES etc.
  • Applsys schema has applications technology layer products like FND and AD etc.
  • Apps is a universal schema, it has synonyms to all base product tables and sequences. This also has code objects for all products (triggers, views, packages, synonyms etc).
  • APPS is central Schema which holds synonyms for all other Users Database Objects.

Note: APPLSYS and APPS should have same password.

Reason why these contains same password.

Both apps & applsys need to have same password because when you sign on to apps, initially it connects to a public schema called APPLSYSPUB. This validates AOL name and password that we enter (operations/welcome). Once this is verified we select responsibility, this is validated by APPLSYS schema and then it connects to apps schema.

During signon process it uses both applsys and apps, hence this expects both the password to be identical. If the password for applsys & apps are not identical (Different) Try changing apps password to something else and try to login, the validation at the last stage would fail. This would result in failure of application login.

Difference B/W APPLSYSPUB & GUEST:

  • APPLSYSPUB/PUB - is DB user which is used by any utility to retrieve APPS schema password for further logins.
  • GUEST/ORACLE - is EBS user with no or max limited privileges to execute authorization function.

Startup Upgrade Mode

What does the "startup upgrade" command do?  How is the startup upgrade different from a normal startup?

Answer:  Starting in 10g, the "startup upgrade" command is used during upgrade procedures.  It differs from a normal startup because only certain operations are permitted. Once the database is started in upgrade mode, only queries on fixed views execute without errors until after the catctl.pl script is run.  Before running catctl.pl, queries on any other view or the use of PL/SQL returns an error.

Start the database in upgrade mode for a multitenant container database (CDB):

SQL> alter pluggable database all open upgrade;

For a non-CDB issue this startup command:

SQL> startup upgrade

Pre-upgrade checks include:

SQL> STARTUP UPGRADE
SQL> SPOOL pre_upgrade_check.log
SQL> @?/rdbms/admin/utlu111i.sql
SQL> SPOOL OFF

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

[oracle3@servername admin]$ cat utlip.sql

Rem Copyright (c) 1998, 2007, Oracle. All rights reserved.

Rem

Rem   NAME

Rem     utlip.sql - UTiLity script to Invalidate Pl/sql

Rem

Rem   DESCRIPTION

Rem

Rem     *WARNING*   *WARNING*  *WARNING*  *WARNING*  *WARNING*  *WARNING*

Rem     Do not run this script directly.

Rem

Rem     utlip.sql is automatically executed when required for database

Rem     upgrades.

Rem     Use utlirp.sql if you are looking to invalidate and recompile

Rem     PL/SQL for a 32-bit to 64-bit conversion. Use dbmsupgnv.sql

Rem     to convert all PL/SQL to NATIVE or dbmsupgin.sql to convert all

Rem     PL/SQL to INTERPRETED.

Rem

Rem     *WARNING*   *WARNING*  *WARNING*  *WARNING*  *WARNING*  *WARNING*

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


Also will share one issue,when we noticed multiple packages or plsql objects are getting invalid frequently then we can acutlay do the below sinario.

Stratup upgrade-->run utlirp.sql to make all plsql objects are invalidate-->then stratup normal mode -->run utlrp.

it will fix the issue.


OCI-CPU-PATCHING

 Installing Database Patch Updates VM DB System in Oracle Cloud Infrastructure

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

dbcli - It is a command line interface available on bare metal and virtual machine DB systems.


It is applied for:(when you choose DB SYSTEM only)

Oracle Database 19.0.0.0.0

Oracle Database 12.1.0.2

Oracle Database 11.2.0.4


Steps:

=====

1.We have to check patch update is available.

2.Prepare for installation of the patch update

3.APPLY Patch applied.

4.Post steps.


Step1:


When a patch update becomes available, it appears in the following locations for an Single Instance VM DB System:

Object Storage Service – dbcli 

Oracle Cloud Infrastructure DB Systems Console - BUT ORACLE RECOMENDS ONLY dbcli

For  install the latest cloud tooling update

cliadm update-dbcli






dbcli update-server --precheck





dbcli update-server

Updating DB HOME
 dbcli list-dbhomes



Apply Database Patch Update

rm -rf /tmp/datapatchoutput*





Note2360215:Oracle Database 19.0.0.0.0 Release Update (RU) or Oracle Database 12.1.0.2 Bundle Patches (BP) or Oracle Database 11.2.0.4 Patch Set Updates (PSU) are automatically included when you create a new Single Instance VM DB System.



SERVER HARDENING

 

Secops team will use some third party tools and when they run they will get risk level of CVE’s in 3 types.

 

Depending on CVSS score level of software,they will be divied in below catagiroies. As per the below link , for Oracle E-Business Suite:
https://www.inoapps.com/insights/news/oracle-has-released-their-third-cpu-of-2020-heres-your-guide-to-the-latest-updatesA maximum reported CVSS Base Score of 9.1, indicating critical vulnerability anything below that is non critical.

Critical

High

Medium

Low

Provide CVE CODE as provided below




 

 

We need to validate each CVE with the below oracle note id/read me of PSU

 




 


Also we get list from the below

https://www.rapid7.com/db/vulnerabilities/oracle-weblogic-cve-2020-5398



 



 

Also When you validate need to check BASE SCORE

 

Validated  CVE with PSU noteid

 

CVE-2017-5645 JAN-2018

CVE-2018-11058 JUL-2019

CVE-2020-2966 JUL-2020

CVE-2020-2967 JUL-2020

CVE-2020-5398 JUL-2020

CVE-2020-5398 JUL-2020

CVE-2020-9546 JUL-2020

CVE-2020-9546 JUL-2020

CVE-2020-14557 JUL-2020 SUpported version after 12.1

CVE-2020-14572,JUL-2020

CVE-2020-14588 JUL-2020

CVE-2020-14589 JUL-2020

CVE-2020-14622 JUL-2020

CVE-2020-14625 JUL-2020

CVE-2020-14644 JUL-2020

CVE-2020-14645 JUL-2020

CVE-2020-14652,JUL-2020

CVE-2020-14687 JUL-2020

 

 

EBS: CPU NOTEID

https://updates.oracle.com/Orion/Services/download?type=readme&aru=23587565

 

Notes: https://www.oracle.com/security-alerts/cpujul2020.html

1.       Outside In Technology is a suite of software development kits (SDKs). The protocol and CVSS score depend on the software that uses the Outside In Technology code. The CVSS score assumes that the software passes data received over a network directly to Outside In Technology code, but if data is not received over a network the CVSS score may be lower.

 

CPU -PATCH ANALSYS