Monday, 10 April 2023

Migrating Oracle Goldengate to Shareplex Steps

 Migrating from Oracle GoldenGate to SharePlex may involve several steps and considerations. Here are some general steps to transform Oracle GoldenGate to SharePlex:


Evaluate SharePlex: Before migrating, evaluate SharePlex to ensure that it meets your data replication needs. Review its features, capabilities, and compatibility with your database systems. This will help ensure that the transition is smooth and that you can achieve your data replication goals with SharePlex.


Prepare for Migration: Determine the scope and scale of the migration, including which database systems and applications need to be migrated. Identify any dependencies, such as third-party software or customizations, that may need to be addressed before the migration.


Set up SharePlex: Set up and configure SharePlex to replicate data from your source database system(s) to your target system(s). This may involve creating new replication configurations or modifying existing ones.


Test Data Replication: Test the data replication process to ensure that data is being replicated accurately and consistently. Conduct thorough testing to identify and address any issues or discrepancies that may arise.


Migrate Data Replication: Once you have tested the data replication process and addressed any

Steps to migrate an Oracle database to PostgreSQL using a backup and restore process:

Take a backup of the Oracle database: Use the Oracle Export utility to take a backup of the Oracle database. One can use the following command to export the database to a single backup file:


php

Code

expdp <username>/<password>@<database_name> directory=<backup_directory> dumpfile=<backup_file_name>.dmp

This will generate a single backup file in Oracle Data Pump format.


Install and configure the Ora2Pg tool: Ora2Pg is a tool that can be used to convert the Oracle backup file into PostgreSQL format. Install and configure the Ora2Pg tool on Oner system.


Convert the Oracle backup to PostgreSQL format: Use the Ora2Pg tool to convert the Oracle backup file to PostgreSQL format. One can use the following command to convert the backup file:


css

Code

ora2pg -c config_file -t TABLE -b <backup_file_name>.dmp -o <output_file_name>.sql

This will generate a SQL file with PostgreSQL syntax.


Create a new PostgreSQL database: Create a new PostgreSQL database to import the converted data. One can use the following command to create a new database:


php

Code

createdb -U <username> -h <hostname> <database_name>

Import the converted data into PostgreSQL: Import the converted data into the new PostgreSQL database. One can use the following command to import the data:


php

Code

psql -U <username> -h <hostname> -d <database_name> -f <output_file_name>.sql

Test the PostgreSQL database: Once the data is imported, test the PostgreSQL database to ensure that it is working as expected.


Please note that the above steps are general and may vary depending on the complexity of Ones database schema and data. Additionally, One may need to modify the configuration file used by Ora2Pg to suit Oner requirements.





Regenerate response

Steps for migrating from Oracle to PostgreSQL using a single backup format:

Install and configure the Ora2Pg tool: Ora2Pg is a tool that can be used to convert Oracle database schema and data into PostgreSQL. Install and configure the Ora2Pg tool on your system.


Convert the Oracle database schema to PostgreSQL: Use the Ora2Pg tool to convert the Oracle database schema to PostgreSQL. You can use the following command to generate the schema.sql file:


graphql

Code

ora2pg -c config_file -t SHOW -o schema.sql

This will generate the schema file with the PostgreSQL syntax.


Create a new PostgreSQL database: Create a new PostgreSQL database to import the converted schema and data. You can use the following command to create a new database:


php

Code

createdb -U <username> -h <hostname> <database_name>

Import the converted schema into PostgreSQL: Import the converted schema into the new PostgreSQL database. You can use the following command to import the schema:


php

Code

psql -U <username> -h <hostname> -d <database_name> -f schema.sql

Convert the Oracle data to PostgreSQL format: Use the Ora2Pg tool to convert the Oracle data into PostgreSQL format. You can use the following command to generate the data.sql file:


kotlin

Code

ora2pg -c config_file -t COPY -o data.sql

Import the converted data into PostgreSQL: Import the converted data into the new PostgreSQL database. You can use the following command to import the data:


php

Code

psql -U <username> -h <hostname> -d <database_name> -f data.sql

Test the PostgreSQL database: Once the data is imported, test the PostgreSQL database to ensure that it is working as expected.


Please note that the above steps are general and may vary depending on the complexity of your database schema and data. Additionally, you may need to modify the configuration file used by Ora2Pg to suit your requirements.

Steps to migrate an Oracle database to Cassandra:

Install and configure the Cassandra Bulk Loader tool: The Cassandra Bulk Loader is a tool that can be used to import data from external sources, including Oracle databases, into Cassandra. Install and configure the Cassandra Bulk Loader tool on Oner system.


Export the Oracle data to CSV format: Use the Oracle Export utility to export the data from the Oracle database to CSV format. One can use the following command to export the data:


php

Code

exp <username>/<password>@<database_name> file=<export_file_name>.csv

This will generate a CSV file containing the Oracle data.


Convert the Oracle data to Cassandra format: Use the Cassandra Bulk Loader tool to convert the Oracle data in CSV format to Cassandra format. One can use the following command to convert the data:


php

Code

sstableloader -d <cassandra_host> -u <username> -pw <password> <export_file_name>.csv

This will convert the data and import it into Cassandra.


Verify the Cassandra data: Once the data is imported, verify the Cassandra data to ensure that it is working as expected.


Please note that the above steps are general and may vary depending on the complexity of Oner Oracle database schema and data. Additionally, One may need to modify the configuration file used by the Cassandra Bulk Loader tool to suit Oner requirements.


~~~~~~~~~~~~~~~~~~~~~~~~

here are some modifications that One may need to make to the Cassandra Bulk Loader configuration file to import data from Oracle:


Change the delimiter: By default, the Cassandra Bulk Loader assumes that the input file uses comma as the delimiter. However, Oracle exports data in CSV format using a semi-colon (;) as the delimiter. To change the delimiter in the configuration file, One can add the following line:


makefile

Code

delimiter=;

Change the input file format: By default, the Cassandra Bulk Loader expects the input file to be in a certain format (SSTable format) that is specific to Cassandra. However, since the input file in this case is in CSV format, One need to specify the input file format as CSV. To do this, One can add the following line:


makefile

Code

input_file_format=CSV

Specify the column names: By default, the Cassandra Bulk Loader assumes that the first row of the input file contains the column names. However, Oracle exports data in CSV format without column names. To specify the column names in the configuration file, One can add the following line:


javascript

Code

input_header=false

This tells the Bulk Loader to skip the first row and use the column names specified in the configuration file.


Specify the mapping between Oracle and Cassandra column names: Since the column names in Oracle may be different from those in Cassandra, One need to specify a mapping between the two sets of column names. To do this, One can add a section to the configuration file that specifies the mapping. For example:


makefile

Code

column_name_mappings={

  "oracle_column_1":"cassandra_column_1",

  "oracle_column_2":"cassandra_column_2",

  "oracle_column_3":"cassandra_column_3",

  ...

}

This maps each Oracle column name to its corresponding Cassandra column name.


Specify the target keyspace and table: Finally, One need to specify the target keyspace and table in the configuration file. For example:


lua

Code

cassandra.output.keyspace=mykeyspace

cassandra.output.table=mytable

Please note that the above modifications are general and may need to be customized based on the specifics of Oner Oracle database and Cassandra keyspace.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


here's an example Cassandra Bulk Loader configuration file that One can use to import data from Oracle:


lua

Code

input_file=/path/to/oracle_export_file.csv

input_file_format=CSV

input_header=false

delimiter=;


cassandra.output.keyspace=mykeyspace

cassandra.output.table=mytable


column_name_mappings={

  "oracle_column_1":"cassandra_column_1",

  "oracle_column_2":"cassandra_column_2",

  "oracle_column_3":"cassandra_column_3",

  ...

}


errors_file=/path/to/errors.log

In this example configuration file:


input_file specifies the path to the Oracle export file in CSV format.

input_file_format specifies that the input file is in CSV format.

input_header is set to false to indicate that the first row of the input file does not contain column names.

delimiter is set to ; to specify that the input file uses semi-colon as the delimiter.

cassandra.output.keyspace and cassandra.output.table specify the target keyspace and table in Cassandra where the data will be imported.

column_name_mappings maps each Oracle column name to its corresponding Cassandra column name. One should replace the example column names with the actual column names in Oner Oracle database and Cassandra keyspace.

errors_file specifies the path to a file where any errors encountered during the import process will be logged.

One can save this configuration file to a file, for example /path/to/bulkloader.conf, and then use the following command to run the Cassandra Bulk Loader tool:


php

Code

sstableloader -d <cassandra_host> -u <username> -pw <password> -c /path/to/bulkloader.conf

This will import the data from the Oracle export file into Cassandra.

Replication Tools Comparison: Oracle GoldenGate Hevo Data Talend Data Integration SharePlex InfoSphere Arcion BryteFlow


 

Here's an updated comparison of Oracle, Postgres, Cassandra, and Microsoft SQL Server that includes additional dimensions:

 








Prerequisites from Exadata to x86 transformation

 From an Oracle certification and support point of view, moving an Oracle database from a physical server to a VMWare virtual machine can also present some risks:


Certification: Oracle has a certification program for hardware and virtualization platforms, which means that Oracle will only provide support for an Oracle database running on a platform that is certified by Oracle. Moving the database to a VMWare virtual machine that is not certified by Oracle can invalidate ones support agreement and potentially cause issues with future upgrades or patches.


Support: Oracle provides support for its products based on the configuration of the hardware and software environment. If one move an Oracle database from a physical server to a virtual machine, one may need to reconfigure the database and the operating system to be compatible with the virtual environment. Any issues that arise due to the virtual environment may not be covered by ones support agreement.


Compatibility: Some Oracle features and options may not be compatible with virtual environments, or may require additional configuration steps to work correctly. If one are using any of these features, one may need to test them in the virtual environment to ensure they work correctly.


To mitigate these risks, it is important to consult with Oracle support and review the Oracle certification program to ensure that the virtual environment one plan to use is compatible with ones Oracle database. One should also perform thorough testing of ones database in the virtual environment before migrating ones production database to ensure that everything works as expected.


~~~~~~~~~~~~~~~~~~Risks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Moving an Oracle database from an Exadata machine to an x86-based server can present some risks and challenges. Some of these include:


Performance issues: Exadata is a specialized platform that is optimized for running Oracle databases. It includes hardware and software optimizations that can improve database performance, such as smart storage and network offloading. Moving to an x86-based server may result in decreased performance, especially for workloads that are I/O-intensive.


Compatibility issues: Exadata uses a specialized version of Oracle Linux that is optimized for the platform. Moving to an x86-based server may require changes to the operating system, hardware, and software configurations to ensure compatibility with the Oracle database.


Licensing issues: Oracle licensing can be complex, and moving from an Exadata machine to an x86-based server may have licensing implications. One may need to purchase additional licenses or change ones licensing model to ensure compliance.


Security concerns: Exadata includes hardware and software security features, such as database encryption and secure boot. Moving to an x86-based server may require additional security measures to ensure that the database is protected.


Migration challenges: Moving an Oracle database from an Exadata machine to an x86-based server can be a complex process that requires careful planning and testing. Any issues that arise during the migration process could result in downtime or data loss.


To mitigate these risks, it is important to carefully plan and test the migration of the Oracle database from Exadata to an x86-based server. One should also consult with Oracle support and review ones licensing agreements to ensure that one are in compliance with Oracle's licensing policies. It may also be beneficial to work with a vendor or consultant who specializes in Oracle database migrations to ensure that the migration is performed correctly and with minimal disruption to ones business operations.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here are some compatibility issues that one may encounter when moving an Oracle database from an Exadata machine to a non-Oracle x86-based server, along with some pre-requisites to address them:


Operating system: Exadata uses a specialized version of Oracle Linux that is optimized for the platform. Moving to a non-Oracle x86-based server may require changes to the operating system to ensure compatibility with the Oracle database. To address this, one can:

Install Oracle Linux on the non-Oracle x86-based server to ensure compatibility with the Oracle database.

Install a version of Linux that is certified by Oracle as compatible with the Oracle database. Check the Oracle certification matrix for the specific version of the database one are using.

Hardware: Exadata includes specialized hardware components, such as InfiniBand networking and flash storage, that are optimized for running Oracle databases. Moving to a non-Oracle x86-based server may require changes to the hardware configuration to ensure compatibility with the Oracle database. To address this, one can:

Check the Oracle certification matrix for the specific hardware components that are certified to work with the Oracle database.

Ensure that the hardware meets the minimum requirements for running the Oracle database, such as CPU, RAM, and storage capacity.

Consider adding hardware components, such as additional disk drives or memory, to improve database performance on the non-Oracle x86-based server.

Oracle Database version: Exadata may be running a different version of the Oracle database than the non-Oracle x86-based server. Moving the database may require upgrading or downgrading the database version to ensure compatibility. To address this, one can:

Check the Oracle certification matrix for the specific database versions that are compatible with the non-Oracle x86-based server.

Plan for any necessary upgrades or downgrades of the database software.

Consider using Oracle's Database Migration Assistant for Unicode (DMU) tool to ensure compatibility between different database versions.

Oracle Database features: Exadata may be using database features that are not available on the non-Oracle x86-based server. Moving the database may require changes to the database configuration to ensure compatibility. To address this, one can:

Review the Oracle documentation to determine which features are available on the non-Oracle x86-based server.

Plan for any necessary changes to the database configuration, such as disabling or reconfiguring features that are not available on the non-Oracle x86-based server.

Third-party software: Exadata may be running third-party software that is not available on the non-Oracle x86-based server. Moving the database may require changes to the software configuration to ensure compatibility. To address this, one can:

Review the third-party software documentation to determine which versions are compatible with the non-Oracle x86-based server.

Plan for any necessary upgrades or changes to the third-party software configuration.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Pre-requisites:


When considering hardware options for running an Oracle database on a non-Oracle x86-based server, there are several factors to consider, including performance, scalability, reliability, and cost. Here are some hardware options one can consider:


Server hardware: One can choose from a wide variety of x86-based servers from different vendors, including Dell, HP, Lenovo, and Supermicro. When choosing a server, consider the CPU, RAM, storage, and network bandwidth, as well as the server's reliability and support options.


Storage: Oracle databases require fast and reliable storage to perform well. One can choose from different types of storage, including direct-attached storage (DAS), network-attached storage (NAS), and storage area network (SAN). When choosing storage, consider the capacity, speed, and reliability of the storage system.


Network: Oracle databases require high-speed network connections to ensure optimal performance. One can choose from different network options, including Ethernet, InfiniBand, and Fibre Channel. When choosing a network, consider the bandwidth, latency, and reliability of the network connection.


Operating system: The operating system one choose should be certified by Oracle to ensure compatibility with the Oracle database. One can choose from different operating systems, including Oracle Linux, Red Hat Enterprise Linux, and SUSE Linux Enterprise Server.


Virtualization: One can choose to run the Oracle database on a virtualized environment to improve scalability and flexibility. One can use virtualization technologies such as VMware, Microsoft Hyper-V, or Oracle VM.


Backup and Recovery: One can choose from different backup and recovery solutions for ones Oracle database, including Oracle Recovery Manager (RMAN), third-party backup solutions, or cloud-based backup solutions.


Ultimately, the hardware options one choose will depend on ones specific requirements, such as performance, scalability, reliability, and cost. One should carefully evaluate ones options and choose hardware that is compatible with the Oracle database and meets ones business needs.


Migrate Exadata X3 to Exadata X8 using Standby

Here are some pre-configuration high-level steps that one should consider before installing an Exadata X8 system:


Verify that the hardware and software meet the minimum requirements for Exadata X8. One can find the hardware and software requirements in the Oracle Exadata Database Machine Installation Guide: https://docs.oracle.com/en/engineered-systems/exadata-database-machine/exadata-database-machine-installation-guide/


Review the Exadata X8 installation documentation and familiarize yourself with the installation process. One can find the installation documentation here: https://docs.oracle.com/en/engineered-systems/exadata-database-machine/exadata-database-machine-installation-guide/


Plan the network configuration for the Exadata X8 system. This includes configuring the Ethernet and InfiniBand networks, assigning IP addresses and hostnames, and setting up DNS and NTP servers. One can find detailed information on network configuration in the Oracle Exadata Database Machine Installation and Configuration Guide: Network Configuration: https://docs.oracle.com/en/engineered-systems/exadata-database-machine/exadata-database-machine-installation-configuration-guide/network-configuration.html


Prepare the existing Oracle databases for migration to Exadata X8. This includes identifying any database features or configurations that may need to be modified, such as database parameters or storage settings. One can find information on migrating databases to Exadata in the Oracle Exadata Database Machine Migration Guide: https://docs.oracle.com/en/engineered-systems/exadata-database-machine/exadata-database-machine-migration-guide/


Ensure that one have the necessary administrative privileges to install and configure the Exadata X8 system. This includes the ability to install software, configure hardware, and create and manage database users and roles.


If one plan to use Oracle Cloud Infrastructure (OCI) with Exadata X8, one should also review the OCI documentation and familiarize yourself with the OCI console and API. One can find the OCI documentation here: https://docs.oracle.com/en-us/iaas/Content/home.htm


These are just a few of the pre-configuration steps that one should consider before installing an Exadata X8 system. I would recommend consulting the Oracle documentation for a more comprehensive list of pre-installation tasks.

~~~~~~~~~~~~~~~~~~~

Install and configure the Exadata X8 hardware components, including the database nodes, storage cells, InfiniBand switches, and PDUs.


Oracle Exadata Database Machine Installation Guide: https://docs.oracle.com/en/engineered-systems/exadata-database-machine/exadata-database-machine-installation-guide/

Configure the network settings, including IP addresses, subnet masks, and hostnames for the database nodes and storage cells.


Oracle Exadata Database Machine Installation and Configuration Guide: Network Configuration: https://docs.oracle.com/en/engineered-systems/exadata-database-machine/exadata-database-machine-installation-configuration-guide/network-configuration.html

Install and configure the Oracle Linux operating system on the database nodes and storage cells.


Oracle Exadata Database Machine Installation and Configuration Guide: Operating System Installation: https://docs.oracle.com/en/engineered-systems/exadata-database-machine/exadata-database-machine-installation-configuration-guide/operating-system-installation.html

Install the Oracle Database software on the database nodes and configure the Oracle Grid Infrastructure.


Oracle Grid Infrastructure Installation Guide: https://docs.oracle.com/en/database/oracle/oracle-database/19/cwlin/oracle-grid-infrastructure-installation-guide-for-linux.html

Configure the Exadata Storage Software on the storage cells, including setting up the Exadata Storage Server Software.


Oracle Exadata Database Machine Installation and Configuration Guide: Storage Configuration: https://docs.oracle.com/en/engineered-systems/exadata-database-machine/exadata-database-machine-installation-configuration-guide/storage-configuration.html

Please note that the above steps are high-level and there may be additional configuration steps or considerations specific to the environment. I would recommend consulting with an Oracle certified professional for assistance with setting up an Exadata X8 system.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The commands to create a standby database on Exadata X8 while the primary database is on Exadata X3:


On the primary database on Exadata X3, create a standby control file:

sql

Code

SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '<file path>';

Replace <file path> with the full path and file name for the standby control file.


Copy the standby control file to the Exadata X8 system:

Use a file transfer utility, such as scp or sftp, to copy the standby control file from the Exadata X3 system to the Exadata X8 system.


On the Exadata X8 system, create a standby database using the standby control file:

sql

Code

SQL> CREATE CONTROLFILE REUSE SET DATABASE <database name> RESETLOGS ARCHIVELOG;

SQL> STARTUP NOMOUNT;

SQL> ALTER DATABASE SET STANDBY DATABASE TO '<primary database TNS alias>'';

SQL> ALTER DATABASE MOUNT STANDBY DATABASE;

Replace <database name> with the name of the standby database, and <primary database TNS alias> with the TNS alias for the primary database on the Exadata X3 system.


Configure the standby database to receive redo data from the primary database:

Configure the necessary Oracle Data Guard parameters, such as the LOG_ARCHIVE_DEST_2 parameter, to allow the standby database to receive redo data from the primary database.


Start the managed recovery process:

sql

Code

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

This will start the managed recovery process, which will apply redo data from the primary database to the standby database.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To convert the database on Exadata X3 as the primary and create a standby database on Exadata X8, perform the following steps:


Convert the database on Exadata X3 to a primary database: On the Exadata X3 system, log in to the database as a privileged user and issue the following command to convert the database to a primary database:

sql

Code

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

This will prepare the database for a switchover to a primary role.


Create a standby database on Exadata X8: On the Exadata X8 system, create a new standby database using Oracle Data Guard. This can be done by following the same steps as for creating a standby database on Exadata X3.


Configure the standby database on Exadata X8: Once the standby database is created, configure it to receive redo data from the primary database on Exadata X3. This involves setting up a network connection between the two systems and configuring the necessary Oracle Data Guard parameters.


Start the standby database: Once the standby database is configured, start it up and make sure that it is synchronized with the primary database on Exadata X3.


Switchover to the new primary database: On the Exadata X3 system, issue the following command to perform a switchover to the new primary database on Exadata X8:


sql

Code

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY;

This will switch the roles of the two databases, making the standby database on Exadata X8 the new primary database.


Verify the switchover: Once the switchover is complete, verify that the new primary database is functioning correctly and that all data is being replicated properly to the standby database on Exadata X8.


Delete the old primary database: Once the switchover is complete and verified, the old primary database on Exadata X3 can be deleted or repurposed as needed.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


CPU, Memory and Storage Ratio for Exadata X3 to Exadata X8 Calculations

 1> Here's a comparison of the hardware specifications of Exadata X3 and X8:


Hardware Component Exadata X3 Exadata X8

CPU Intel Xeon E5-2690 2.9 GHz 8-core Intel Xeon Gold 6230 2.1 GHz 20-core

Memory 512 GB DDR3 1.5 TB DDR4

Storage 22 TB Raw Flash Storage + 168 TB Raw Disk Storage 44 TB Raw Flash Storage + 720 TB Raw Disk Storage


As one can see, the CPU in Exadata X8 has more cores than Exadata X3, which allows it to process more workloads in parallel. The memory capacity is also higher in Exadata X8, which enables it to store and access more data at a faster rate. The storage capacity of Exadata X8 is significantly higher than Exadata X3, which means it can accommodate larger databases.


To convert Exadata X3 to X8, one would need to consider the ratio of each hardware component to ensure a smooth upgrade. For example, if one want to upgrade the CPU, one would need to calculate the ratio of cores and clock speed between the two models to ensure that the new CPU is compatible with the existing motherboard and other components.



2> To calculate the ratio of cores and clock speed between the two models, we can use the following formula:


(Cores X New Clock Speed) / (Old Cores X Old Clock Speed) = Ratio


For example, let's calculate the ratio for the CPUs of Exadata X3 and X8:


Exadata X3 CPU:


Cores: 8

Clock Speed: 2.9 GHz

Exadata X8 CPU:


Cores: 20

Clock Speed: 2.1 GHz

Ratio calculation:


(20 cores X 2.1 GHz) / (8 cores X 2.9 GHz) = 1.81


Therefore, the ratio of cores and clock speed between the Exadata X3 and X8 CPUs is approximately 1.81. This means that the new CPU in Exadata X8 is about 1.81 times faster than the CPU in Exadata X3, which should provide a significant performance improvement.


However, it's important to note that upgrading the CPU alone may not be sufficient for a successful migration, as other hardware components such as memory and storage may also need to be upgraded to ensure compatibility and optimal performance.


3> Here are the memory and storage specifications for Exadata X3 and X8:


Exadata X3:


Memory: 512 GB DDR3

Storage: 22 TB Raw Flash Storage + 168 TB Raw Disk Storage

Exadata X8:


Memory: 1.5 TB DDR4

Storage: 44 TB Raw Flash Storage + 720 TB Raw Disk Storage

To calculate the ratio of memory and storage between the two models, we can use the following formula:


(New Memory or Storage / Old Memory or Storage) = Ratio


a) Memory Ratio Calculation:


(1.5 TB DDR4) / (512 GB DDR3) = 2.93


Therefore, the ratio of memory between the Exadata X3 and X8 is approximately 2.93. This means that the memory in Exadata X8 is almost three times larger than the memory in Exadata X3.


b) Storage Ratio Calculation:


(44 TB Raw Flash Storage + 720 TB Raw Disk Storage) / (22 TB Raw Flash Storage + 168 TB Raw Disk Storage) = 4.49


Therefore, the ratio of storage between the Exadata X3 and X8 is approximately 4.49. This means that the storage in Exadata X8 is almost 4.5 times larger than the storage in Exadata X3.


It's important to note that when upgrading from Exadata X3 to X8, it's not just about the raw size of the memory and storage, but also the technology used. For example, DDR4 memory is faster and more power-efficient than DDR3, and flash storage is faster than disk storage. Upgrading to Exadata X8 will provide both larger memory and storage capacities, as well as access to faster and more efficient technology.


Source: Based on my experience, I referred the hardware specifications for Exadata X3 and X8 are publicly available on the Oracle website and other sources, and the calculations are basic mathematical formulas that are commonly used to compare hardware specifications. However, any confirmed information will be coming from Oracle Support.


Saturday, 9 April 2016

ASmLib download

$ rpm -qa | grep asmlib

$ /usr/sbin/oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes

If the ASMLib RPM's are missing in your environment.

Please download the appropriate rpms for your version.

http://www.oracle.com/technetwork/server-storage/linux/asmlib/ol6-1709075.html

Change Hostnames in RAC setup

1> Capture Resource Definitions

Before doing anything, we should capture resource definitions from the current CRS resources. This is an optional step, but it will simplify configuration later.

A single resource definition can be captured with a command $ORA_CRS_HOME/bincrs_stat -p . Here is a small shell script to capture that for every resource and save it into a .cap file. As you will see later these files can be used to easily recreate resources:

for res in `$ORA_CRS_HOME/bin/crs_stat -p | grep "^NAME=" | cut -d = -f 2` ; do
    $ORA_CRS_HOME/bin/crs_stat -p $res >/opt/oracle/resources/$res.cap
done


2> Stop Clusterware

Now you can stop Oracle Clusterware on all nodes using $ORA_CRS_HOME/bin/crsctl stop crs, and then change hostnames. Note that this will stop all databases, listeners, and other resources registered within CRS, so this is the time when outage starts.

3> Rename Hosts
Ask SA to change Hostnames

Please note the following important points with respect to changing hostname.
1> Make sure that aliases in /etc/hosts are amended.
2> Don’t forget to change aliases for VIPs and private IPs. This is not strictly required but you are better off following the standard naming convention (-priv and -vip for interconnect and virtual IP respectively) unless you have really good reason not to. Note that at this stage you should be also able to change IP addresses as well. I didn’t try it, but it should work.
3> Also make sure DNS configuration is also changed by your SA, if your applications use DNS to resolve hostnames.

4> Modify $ORA_CRS_HOME/install/rootconfig

$ORA_CRS_HOME/install/rootconfig is called as part of the root.sh script run after Oracle Clusterware installation. We have to modify it so that it uses different host names.

Generally, you would simply change every appearance of the old hostnames to the new hostnames. If you want to do that in vi, use :%s/old_node/new_node/g. Be careful not to change existing non-relevant parts of the script matching your old hostname. The variables that should be changed are

    CRS_HOST_NAME_LIST
    CRS_NODE_NAME_LIST
    CRS_PRIVATE_NAME_LIST
    CRS_NODELIST
    CRS_NODEVIPS

The latter might need modification if you also change IPs.

At this stage, you can also change your OCR and voting disks locations. The following lines should be changed:

CRS_OCR_LOCATIONS={OCR path},{OCR mirror path}
CRS_VOTING_DISKS={voting disk1 path},{voting disk2 path},{voting disk3 path}

You can also change your cluster name via the variable CRS_CLUSTER_NAME.
5> Cleanup OCR and Voting Disks

You should clear OCR and voting disks, otherwise, the script will refuse to format them. This can be done using dd. In the example below I have mirrored OCR and 3 voting disks:

dd if=/dev/zero of= bs=1024k
dd if=/dev/zero of={OCR2 path} bs=1024k
dd if=/dev/zero of={voting1 path} bs=1024k
dd if=/dev/zero of={voting2 path} bs=1024k
dd if=/dev/zero of={voting3 path} bs=1024k

6> “Break” Clusterware Configuration

rootconfig has some protection  — it checks if Clusterware has been already configured and, if it has, it exits without doing any harm. One way to “break” the configuration and make this script run for a second time is to delete the file /etc/oracle/ocr.loc. (Note that this is a Linux-specific location; other Unix variants might have different path. On HP-UX, for example, it’s something like /var/opt/oracle/ocr.log if I recall correctly.)
Run $ORA_CRS_HOME/install/rootconfig

If everything has gone alright, you should be able to run $ORA_CRS_HOME/install/rootconfig as the root user without any issues. If there are problems, follow the standard CRS troubleshooting procedure — checking /var/log/messages and $ORA_CRS_HOME/log/{nodename} et cetera.

Note that this should be done on every node one by one — sequentially. On the last node of the cluster, the script will try to configure the VIPs, and there is a known bug here if you use a private range IP for VIP. This can be easily fixed by running $ORA_CRS_HOME/bin/vipca manually in graphical mode (i.e. you will need $DISPLAY configured correctly).
Verify Clusterware Configuration and Status

This is a simple check to make sure that all nodes are up and have VIP components configured correctly:

[root@mch10 bin]# $ORA_CRS_HOME/bin/crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.mch10.gsd   application    ONLINE    ONLINE    mch10
ora.mch10.ons   application    ONLINE    ONLINE    mch10
ora.mch10.vip   application    ONLINE    ONLINE    mch10
ora.mch11.gsd   application    ONLINE    ONLINE    mch11
ora.mch11.ons   application    ONLINE    ONLINE    mch11
ora.mch11.vip   application    ONLINE    ONLINE    mch11

7> Adding Listener Resources to CRS

There are two ways to do this — you can either use netca to configure the listener from scratch (you might need to clean it up from listener.ora first), or you can change the configuration manually and register it with CRS from command line. I’ll show how to that manually — obviously, the preferred way when it comes to the real environments. ;-)

First of all, we will need to change the $ORACLE_HOME/network/admin/listener.ora file, and you will probably want to change tnsnames.ora at the same time. You need to replace old node aliases with new ones, and change the IPs if they are used instead of aliases, and if you changed them above during clusterware reconfiguration.

Note that depending on how your LOCAL_LISTENER and REMOTE_LISTENER init.ora parameters are set, you might need to change them: if they reference connections descriptors from tnsname.ora, then only the latter should be changed, but if there are full connection descriptors, they should also be modified).

You should also change listener names to reflect new hostnames. Usually, listeners are named as LISTENER_{hostname}, and you should keep this convention again unless you have a very good reason not to. Do that on both nodes if you don’t have a shared ORACLE_HOME.

Now it’s time to get back to the .cap files with the CRS resource definitions we captured when we began. The files we are interested in are in format ora.{hostname}.LISTENER_{HOSTNAME}.lsnr.cap. In my case, one of them is ora.vs10a.LISTENER_VS10A.lsnr (my old hostname was vs10a). If you changed listener names above, you would need to amend it there as well — NAME=ora.mch10.LISTENER_VS10.lsnr, and rename the file according to the new host name following the same naming convention.

Your VIP name has probably changed, so this line should be modified as well: REQUIRED_RESOURCES=ora.mch10.vip. And finally, the hosting member will change: HOSTING_MEMBERS=mch10. Check the whole file carefully — you should simply modify the old hostname to the new one in both lower and upper case.

Now it’s time to register the resource — the crs_register command does just that. This command specifies the resource name to register and the directory where the .cap file is located. It should be named exactly like resource name plus a “.cap” extension. Each node’s listener can be added from the same node. It’s important that the content of the .cap file is modified appropriately. Assuming I have files ora.mch10.LISTENER_VS10.lsnr and ora.mch11.LISTENER_VS11.lsnr in directory /opt/oracle/A/resources, I run:

$ORA_CRS_HOME/bin/crs_register ora.mch10.LISTENER_VS10.lsnr -dir /opt/oracle/A/resources
$ORA_CRS_HOME/bin/crs_register ora.mch11.LISTENER_VS11.lsnr -dir /opt/oracle/A/resources

Now the output from crs_stat -t should be:

Name           Type           Target    State     Host
------------------------------------------------------------
ora....10.lsnr application    OFFLINE   OFFLINE
ora.mch10.gsd   application    ONLINE    ONLINE    mch10
ora.mch10.ons   application    ONLINE    ONLINE    mch10
ora.mch10.vip   application    ONLINE    ONLINE    mch10
ora....11.lsnr application    OFFLINE   OFFLINE
ora.mch11.gsd   application    ONLINE    ONLINE    mch11
ora.mch11.ons   application    ONLINE    ONLINE    mch11
ora.mch11.vip   application    ONLINE    ONLINE    mch11

It’s now time to start the listeners:

$ORA_CRS_HOME/bin/srvctl start nodeapps -n mch10
$ORA_CRS_HOME/bin/srvctl start nodeapps -n mch11

crs_stat -t should show the listeners online:

Name           Type           Target    State     Host
------------------------------------------------------------
ora....10.lsnr application    ONLINE    ONLINE    mch10
ora.mch10.gsd   application    ONLINE    ONLINE    mch10
ora.mch10.ons   application    ONLINE    ONLINE    mch10
ora.mch10.vip   application    ONLINE    ONLINE    mch10
ora....11.lsnr application    ONLINE    ONLINE    mch11
ora.mch11.gsd   application    ONLINE    ONLINE    mch11
ora.mch11.ons   application    ONLINE    ONLINE    mch11
ora.mch11.vip   application    ONLINE    ONLINE    mch11

8.> Adding ASM Instances to CRS

This step is optional, and it you don’t use ASM, skip it.

Unfortunately, we can’t simply use .cap files to register ASM resources. There are more pieces required and the only way I could find to register ASM instances is to use srvctl which is, actually, a more supported option. This is simple:

$ORACLE_HOME/bin/srvctl add asm -n mch10 -i ASM1 -o $ORACLE_HOME
$ORACLE_HOME/bin/srvctl add asm -n mch11 -i ASM1 -o $ORACLE_HOME
$ORACLE_HOME/bin/srvctl start asm -n mch10
$ORACLE_HOME/bin/srvctl start asm -n mch11

There is a catch — sometimes I had to prefix the name of the ASM instance with a “+” (i.e. making it like -i +ASM1) and sometimes no plus-sign was required.

crs_stat -t should show now:

Name           Type           Target    State     Host
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    mch10
ora....10.lsnr application    ONLINE    ONLINE    mch10
ora.mch10.gsd   application    ONLINE    ONLINE    mch10
ora.mch10.ons   application    ONLINE    ONLINE    mch10
ora.mch10.vip   application    ONLINE    ONLINE    mch10
ora....SM2.asm application    ONLINE    ONLINE    mch11
ora....11.lsnr application    ONLINE    ONLINE    mch11
ora.mch11.gsd   application    ONLINE    ONLINE    mch11
ora.mch11.ons   application    ONLINE    ONLINE    mch11
ora.mch11.vip   application    ONLINE    ONLINE    mch11

9.> Register Databases

For each database, you need to register a database resource. Then, for every instance, you need to register an instance resource. So for database A, my two-node cluster, I use:

$ORACLE_HOME/bin/srvctl add database -d A -o $ORACLE_HOME
$ORACLE_HOME/bin/srvctl add instance -d A -i A1 -n mch10
$ORACLE_HOME/bin/srvctl add instance -d A -i A2 -n mch11
$ORACLE_HOME/bin/srvctl start database -d A

10.> Finally, crs_stat -t should show all resources online:

Name           Type           Target    State     Host
------------------------------------------------------------
ora.A.A1.inst  application    ONLINE    ONLINE    mch10
ora.A.A2.inst  application    ONLINE    ONLINE    mch11
ora.A.db       application    ONLINE    ONLINE    mch10
ora....SM1.asm application    ONLINE    ONLINE    mch10
ora....10.lsnr application    ONLINE    ONLINE    mch10
ora.mch10.gsd   application    ONLINE    ONLINE    mch10
ora.mch10.ons   application    ONLINE    ONLINE    mch10
ora.mch10.vip   application    ONLINE    ONLINE    mch10
ora....SM2.asm application    ONLINE    ONLINE    mch11
ora....11.lsnr application    ONLINE    ONLINE    mch11
ora.mch11.gsd   application    ONLINE    ONLINE    mch11
ora.mch11.ons   application    ONLINE    ONLINE    mch11
ora.mch11.vip   application    ONLINE    ONLINE    mch11

11.> Other Resources

If you had other resources like services, user VIPs, or user-defined resources, you will probably be fine using the crs_register command to get them back into CRS. I didn’t try it, but it should work.
Final Check

To make sure that everything is working, you should at least reboot every node and see if everything comes up.

I don’t know if that operation is considered to be supported. The only slippery bit is modifying the $ORA_CRS_HOME/install/rootconfig file, because it’s usually created by the Universal Installer. Another tricky place is the “unusual” registration of listeners. Otherwise, all the commands are pretty much usual stuff, I think. Good luck!

Opatch Permission libraries Issue

I see that all the files which should be owned by root are owned by grid user on node C.

As ROOT user, please run below command on node C - and share " ls -alrt /usr/products/grid/grid_home/12.1.0.2/lib"

/crs/install/rootcrs.sh -prepatch
/rdbms/install/rootadd_rdbms.sh
/crs/install/rootcrs.sh -postpatch

Thanks,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

unlock and re-lock the GI  to  verify whether permissions remains same or getting changed

As root:

# $GRID_HOME/crs/install/rootcrs.pl -unlock -crshome $GRID_HOME            >>>>>>>stop the crs 
# $GRID_HOME/crs/install/rootcrs.pl -patch>>>>>>>starts the crs

And, then share the " ls -alrt /usr/products/grid/grid_home/12.1.0.2/lib"

Add Node

1> Compare the mentioned file in the new and old environment: "/etc/sysctl.conf" file.
2> Compare the mentioned file in the new and old environment: "/etc/security/limits.conf" file.
3> Compare the mentioned file in the new and old environment "/etc/pam.d/login" file.
4> Create the necessary oracle groups and users.
5> chkconfig ntpd status
6> Create the .profile for setting the environment for grid and oracle user (Compare the mentioned file in the new and old environment)
"/home/oracle/.bash_profile" file and "/home/grid/.bash_profile"
"/home/oracle/grid_env" and "/home/grid/grid_env"
"/home/oracle/db_env" and "/home/grid/db_env"
7> uname -rm
8> All necessary ASM libraries and packages
9> Ping all the IPs of the New_Node
ping -c 3 112-rac1
ping -c 3 112-rac1-priv
ping -c 3 112-rac1-vip

10> ASM must be configured and "#oracleasm listdisks" command on the New_Node should show all the disks.
Few command reference : oracleasm listdisks, oracleasm init, oracleasm scandisks

11> Configure secure shell for oracle user on all nodes

From oracle_home/oui/bin on existing Node -
./runSSHSetup.sh -user oracle -hosts "Existing_Node New_Node" -advanced -exverify

12> Verify New_Node (HWOS)

From grid_home on existing Node
$GRID_HOME/bin/cluvfy stage -post hwos -n New_Node > /u02/hwos.log

13> Verify Peer (REFNODE)

From grid_home on existing Node
$GRID_HOME/bin/cluvfy comp peer -refnode existing Node -n New_Node -orainv oinstall -osdba dba -verbose > /u02/comppeer.log

14> Verify New_Node (New_Node PRE)

From grid_home on existing Node
$GRID_HOME/bin/cluvfy stage -pre nodeadd -n New_Node -fixup -verbose > /u02/fixup.log

14> Extend Clusterware

Run “addNode.sh”

a) [oracle@existing Node bin]$ ./addNode.sh -silent "CLUSTER_NEW_NODES={New_Node}" "CLUSTER_NEW_VIRTUAL_HOSTNAMES={New_Node-vip}"
From root user on New_Node :::

b) [root@New_Node oraInventory]# ./orainstRoot.sh
From root user on New_Node :::

c) [root@New_Node oraInventory]# cd /u01/app/11.2.0/grid/
[root@New_Node grid]# ./root.sh

If successful, clusterware daemons, the listener, the ASM instance, etc. should be started

d) [oracle@New_Node ~]$ crsctl check crs
e) [oracle@New_Node ~]$ crs_stat -t -v
f) [oracle@New_Node ~]$ olsnodes -n
Existing Node  1
Existing_Node 2
New_Node  3

g)[oracle@New_Node ~]$ srvctl status asm -a
ASM is running on Existing_Node,New_Node,existing Node
ASM is enabled.

h) [oracle@New_Node ~]$ ocrcheck
i) [oracle@New_Node ~]$ crsctl query css votedisk

15) Verify New_Node (New_Node POST)

[oracle@existing Node u02]$ $GRID_HOME/bin/cluvfy stage -post nodeadd -n New_Node -verbose > /u02/clusterpost.log

Friday, 8 April 2016

ASM Block Header 0 Corruption

Reference: How To Restore/Repair/Fix An Overwritten (KFBTYP_INVALID) ASM Disk Header (First 4K) 10.2.0.5, 11.1.0.7, 11.2 And Onwards (Doc ID 1088867.1) 

To confirm if just block 0 is corrupted or there are more blocks, please execute this script and upload .out files
kfed.sh
-----
#! /bin/sh
rm /tmp/kfed_DH.out /tmp/kfed_FS.out /tmp/kfed_BK.out /tmp/kfed_FD.out /tmp/kfed_DD.out
for i in `ls /dev/emc*`
do
echo $i >> /tmp/kfed_DH.out
kfed read $i >> /tmp/kfed_DH.out
echo $i >> /tmp/kfed_FS.out
kfed read $i blkn=1 >> /tmp/kfed_FS.out
echo $i >> /tmp/kfed_BK.out
kfed read $i aun=1 blkn=254 >> /tmp/kfed_BK.out
echo $i >> /tmp/kfed_FD.out
kfed read $i aun=2 blkn=1 >> /tmp/kfed_FD.out
echo $i >> /tmp/kfed_DD.out
kfed read $i aun=2 blkn=2 >> /tmp/kfed_DD.out
done
----

That way we can see which au's are affected

Please, upload asmdu output too:
amdu -diskstring '' -dump

and the OS logs

Additionally, please upload:
1) full ASM alertlog

2) Please connect to ASM instance, generate and upload /tmp/ASM_#.html file as result of output from v$asm_disk and v$asm_diskgroup:

---------------------- cut -------------------------
         spool /tmp/ASM_<#>.html
         set markup HTML on
         set pagesize 1000
         set lines 500
         alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';
         select sysdate "Date and Time" from dual;
         select 'HOSTNAME ASSOCIATED WITH THIS ASM INSTANCE: ==)> ' , MACHINE " " from v$session where program like '%SMON%';

         select * from v$asm_diskgroup order by 1;
         select * from v$asm_disk order by 1, 2, 3;
         select * from gv$asm_operation order by 1;
         select * from v$version where banner like '%Database%' order by 1;
         select * from gv$asm_client order by 1;
         select group_number, name, value FROM v$asm_attribute where NAME like 'disk_repair_time';

         show parameter asm
         show parameter size
         show parameter proc
         show parameter cluster
         show parameter instance_type
         show parameter instance_name

         show parameter pfile

         show sga

         spool off

--------------------- end cut -----------------------

Grid Install on Windows for Oracle Restart

1. Oracle software owner account creation

 Create a user oracle and assign Administrator group

Check that you can connect to Windows server with the oracle user account.

2.  Oracle software file system creation

On my server I have assigned letter H to new file system with following commands run with Administrator:

C:\Users\Administrator> diskpart

Microsoft DiskPart version 6.2.9200

Copyright (C) 1999-2012 Microsoft Corporation.
On computer: W12DC02

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online           25 GB      0 B
  Disk 1    Online           25 GB    25 GB
  Disk 2    Online           10 GB    10 GB
  Disk 3    Online           10 GB    10 GB

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> create partition extended

DiskPart succeeded in creating the specified partition.

DISKPART> create partition logical

DiskPart succeeded in creating the specified partition.

DISKPART>


DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     D   VBOXADDITIO  CDFS   CD-ROM        55 MB  Healthy
  Volume 1     E                       CD-ROM          0 B  No Media
  Volume 2         System Rese  NTFS   Partition    350 MB  Healthy    System
  Volume 3     C                NTFS   Partition     24 GB  Healthy    Boot
  Volume 4                      RAW    Partition     24 GB  Healthy

DISKPART> select volume 4

Volume 4 is the selected volume.

DISKPART> format fs=ntfs

  100 percent completed

DiskPart successfully formatted the volume.

DISKPART> assign letter=h

DiskPart successfully assigned the drive letter or mount point.

DISKPART> detail partition

Partition 1
Type  : 07
Hidden: No
Active: No
Offset in Bytes: 2097152

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 4     H                NTFS   Partition     24 GB  Healthy

DISKPART> exit

Leaving DiskPart...
PS C:\Users\Administrator> cmd.exe
Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.

C:\Users\Administrator>dir h:
 Volume in drive H has no label.
 Volume Serial Number is E837-1047

 Directory of H:\

File Not Found

C:\Users\Administrator>

ASM storage configuration

Run following commands with Administrator account from a Powershell session:

PS C:\Users\Administrator> diskpart

Microsoft DiskPart version 6.2.9200

Copyright (C) 1999-2012 Microsoft Corporation.
On computer: W12DC02

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online           25 GB      0 B
  Disk 1    Online           25 GB  1024 KB
  Disk 2    Online           10 GB    10 GB
  Disk 3    Online           10 GB    10 GB

DISKPART> select disk 2

Disk 2 is now the selected disk.

DISKPART> create partition extended

DiskPart succeeded in creating the specified partition.

DISKPART> create partition logical

DiskPart succeeded in creating the specified partition.

DISKPART> select disk 3

Disk 3 is now the selected disk.

DISKPART> create partition extended

DiskPart succeeded in creating the specified partition.

DISKPART> create partition logical

DiskPart succeeded in creating the specified partition.

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     D   VBOXADDITIO  CDFS   CD-ROM        55 MB  Healthy
  Volume 1     E                       CD-ROM          0 B  No Media
  Volume 2         System Rese  NTFS   Partition    350 MB  Healthy    System
  Volume 3     C                NTFS   Partition     24 GB  Healthy    Boot
  Volume 4     H                NTFS   Partition     24 GB  Healthy
  Volume 5                      RAW    Partition      9 GB  Healthy
* Volume 6                      RAW    Partition      9 GB  Healthy

DISKPART> exit

Leaving DiskPart...
PS C:\Users\Administrator>

Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.

PS C:\Users\Administrator> cd F:\winx64_12102_grid\grid\asmtool
PS F:\winx64_12102_grid\grid\asmtool> dir


    Directory: F:\winx64_12102_grid\grid\asmtool


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-----        11/09/2014     09:56      11776 asmtool.exe
-----        11/09/2014     09:56      25088 asmtoolg.exe
-----        30/04/2012     01:57     608080 msvcp100.dll
-----        30/04/2012     01:57     829264 msvcr100.dll
-----        22/05/2012     11:13     362496 msvcrt.dll
-----        11/09/2014     09:56       4608 oraasmtoolus.msb
-----        02/08/2014     02:46    1755136 oracore12.dll
-----        11/09/2014     10:51     117248 oraimr12.dll
-----        04/08/2014     16:17    1041408 oranls12.dll
-----        04/08/2014     15:53     241664 orasnls12.dll
-----        04/08/2014     15:53     105472 oraunls12.dll
-----        02/08/2014     02:46       9728 orauts.dll


PS F:\winx64_12102_grid\grid\asmtool>
PS F:\winx64_12102_grid\grid\asmtool> .\asmtool -list
NTFS                             \Device\Harddisk0\Partition1              350M
NTFS                             \Device\Harddisk0\Partition2            25248M
NTFS                             \Device\Harddisk1\Partition1            25597M
                                 \Device\Harddisk2\Partition1            10237M
                                 \Device\Harddisk3\Partition1            10237M
PS F:\winx64_12102_grid\grid\asmtool> .\asmtool -add  \Device\Harddisk2\Partition1 ORCLDISK1
PS F:\winx64_12102_grid\grid\asmtool> .\asmtool -add  \Device\Harddisk3\Partition1 ORCLDISK2
PS F:\winx64_12102_grid\grid\asmtool> .\asmtool -list
NTFS                             \Device\Harddisk0\Partition1              350M
NTFS                             \Device\Harddisk0\Partition2            25248M
NTFS                             \Device\Harddisk1\Partition1            25597M
ORCLDISK1                        \Device\Harddisk2\Partition1            10237M
ORCLDISK2                        \Device\Harddisk3\Partition1            10237M
PS F:\winx64_12102_grid\grid\asmtool>

The 2 10 Gb raw disk partitions are now ready to be used by ASM.

3. Verify Oracle Restart host cluvfy

cluvfy stage -pre  hacfg -verbose

4. Software  and ASM disk locations

/u01/app/oraInventory             --> Inventory
/u01/app/1202/grid                --> GRID_HOME     Version 12.1.0.2
/u01/app/oracle/product/11204/ors --> ORACLE_HOME
/u01/app/oracle                   --> ORACLE_BASE   Version 11.2.0.4

ASM Disk protection:
# ls -l  /dev/asm_data_11g_disk1
brw-rw----. 1 oracle oinstall 8, 17 Sep  5 15:41 /dev/asm_data_11g_disk1

5. Install 12c Oracle Grid Infracstructure for a Standalone Server

[oracle@test grid]$ ./runInstaller
  -->  Install and confgure Oracle Grid Infr. for a Standalone Server
  --> Create ASM device : DG DATA
..
[root@test12 app]# /u01/app/1202/grid/root.sh

6. Verify DG
[oracle@test12 ~]$ asmcmd lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     10236     8712                0            8712              0             N  DATA/


Wednesday, 27 January 2016

To investigate and fix ASM disk header corruption

How To Restore/Repair/Fix An Overwritten (KFBTYP_INVALID) ASM Disk Header (First 4K) 10.2.0.5, 11.1.0.7, 11.2 And Onwards (Doc ID 1088867.1) 

To confirm if just block 0 is corrupted or there are more blocks, please execute this script and upload .out files
kfed.sh
-----
#! /bin/sh
rm /tmp/kfed_DH.out /tmp/kfed_FS.out /tmp/kfed_BK.out /tmp/kfed_FD.out /tmp/kfed_DD.out
for i in `ls /dev/emc*`
do
echo $i >> /tmp/kfed_DH.out
kfed read $i >> /tmp/kfed_DH.out
echo $i >> /tmp/kfed_FS.out
kfed read $i blkn=1 >> /tmp/kfed_FS.out
echo $i >> /tmp/kfed_BK.out
kfed read $i aun=1 blkn=254 >> /tmp/kfed_BK.out
echo $i >> /tmp/kfed_FD.out
kfed read $i aun=2 blkn=1 >> /tmp/kfed_FD.out
echo $i >> /tmp/kfed_DD.out
kfed read $i aun=2 blkn=2 >> /tmp/kfed_DD.out
done
----

That way we can see which au's are affected

Please, upload asmdu output too:
amdu -diskstring '' -dump

and the OS logs

Additionally, please upload:
1) full ASM alertlog

2) Please connect to ASM instance, generate and upload /tmp/ASM_#.html file as result of output from v$asm_disk and v$asm_diskgroup:

---------------------- cut -------------------------
         spool /tmp/ASM_<#>.html
         set markup HTML on
         set pagesize 1000
         set lines 500
         alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';
         select sysdate "Date and Time" from dual;
         select 'HOSTNAME ASSOCIATED WITH THIS ASM INSTANCE: ==)> ' , MACHINE " " from v$session where program like '%SMON%';

         select * from v$asm_diskgroup order by 1;
         select * from v$asm_disk order by 1, 2, 3;
         select * from gv$asm_operation order by 1;
         select * from v$version where banner like '%Database%' order by 1;
         select * from gv$asm_client order by 1;
         select group_number, name, value FROM v$asm_attribute where NAME like 'disk_repair_time';

         show parameter asm
         show parameter size
         show parameter proc
         show parameter cluster
         show parameter instance_type
         show parameter instance_name

         show parameter pfile

         show sga

         spool off

--------------------- end cut -----------------------

Steps to Convert RAC to Non-RAC Setup

Summary of Steps to Convert RAC to Non-RAC Setup:

There are several scenarios for this situation:

1. Converting RAC instances to non-RAC instances permanently without keeping the Oracle Clusterware.
2. Converting RAC instances to non-RAC instances permanently, but still keeping the Oracle Clusterware.
3. Converting RAC instances to non-RAC instances temporarily, so the production DB can continue running while troubleshooting of RAC issues is in progress.

In all cases, the Clusterware should be shutdown on other nodes to avoid conflicts of the operations.

1. Converting RAC instances to non-RAC instances permanently without keeping the Oracle Clusterware.

a.) Shutdown clusterware on ALL nodes with root user.
b.) Run rootdelete and rootdeinstall with root user.
c.) Run installer and remove the Clusterware home with crs user.
d.) Install a new single instance home with oracle user. Also a separate ASM home if preferred.
e.) As oracle user, remove the listener using netca from the OLD home. Create a new local listener using netca from the NEW home. The listener will not listen to VIP anymore. Change existing tnsnames.ora files on server and/or clients to use host IP instead of VIP.
f.) Configure ASM using dbca from the new home with oracle user. Follow the instruction from dbca to create non-RAC CSS using “localconfig add” with root user.
g.) With oracle user, copy the pfile/spfile from the old DB home to the new DB home, remove all the parameters for other instances in the pfile/spfile.

— Remove cluster_database and cluster_database_instances parameters.
— Remove undo_tablespace parameter for the other instances.
— Remove remote_listener and local_listener parameters if present.

h.) Startup new listener and ASM with oracle user. Make sure ASM diskgroups are mounted.
i.) With oracle user, startup the database in mount stage and execute
alter database disable thread ;
alter database open;
j.) After opening database you can drop the redolog groups and/or tablespaces which are for other instances.
k.) With oracle user, modify the ORACLE_HOME on /etc/oratab. And remove instance_number and thread parameters in the pfile/spfile.
l.) With oracle user, run installer to remove the OLD ORACLE_HOME.

2. Converting RAC instances to non-RAC instances permanently, but still keeping the Oracle Clusterware.

In this scenario, it is also recommended to just install a Single Instance home and then start ASM and Database instances from the new home. (If preferred, a separate single-instance ASM home can be installed.) So, the inventory can be in sync of the changes, and this could prevent related problems in the future.

a.) Leave the Oracle Clusterware as it is.
b.) With oracle user, install a new SI home (runInstaller gives you option to install RAC enabled home or SI home). Also a separate ASM home if preferred.
c.) With root user, stop Clusterware on all node except the current node. Stop DB/ASM instances and remove instance registries in the OCR using the srvctl from the old home with crs user.
$ srvctl remove instance -d -i
$ srvctl remove database -d
$ srvctl remove asm -n [-i ]

d.) With oracle user, remove listeners using netca from the old home.
e.) With oracle user, create a new listener using netca from the new home. If the listener will not listen to VIP anymore, change existing tnsnames.ora files on server and/or clients to use host IP instead of VIP.
f.) With oracle user, configure single instance ASM using dbca from the new home.
g.) Convert and start DB instance from the new home. See step g to l in scenario #1.
h.) If preferred, register DB to the OCR.

3. Converting RAC instances to non-RAC instances temporarily, so the production DB can continue running while troubleshooting of RAC issues is in progress.

** Please note that while staying in this transition status, please DO NOT apply any RDBMS patch without first converting back to RAC.
a.) Shutdown all instances including ASM and DB instances in RAC environment on ALL nodes with oracle user.
b.) Shutdown all the listeners on ALL nodes with oracle user.
c.) With oracle user, relink Oracle executable with rac_off option. (For both ASM and DB homes)
$ make -f ins_rdbms.mk rac_off
$ make -f ins_rdbms.mk ioracle

d.) With oracle user, remove all parameters for other instances in the pfile/spfile.
— Remove cluster_database and cluster_database_instances parameters. (For both ASM and DB)
— Remove undo_tablespace parameter for the other instances. (For DB only)

e.) With oracle user, startup listener and ASM. Make sure ASM diskgroups are mounted.
f.) With oracle user, startup the database in mount stage and execute
alter database disable thread ;
alter database open;

g.) After opening database you can drop the redolog groups and/or tablespaces which are for other instances.
h.) Disable autostart of ASM/DB/Clusterware. (Re-enable them after fixing the CRS/RAC issue)
$ srvctl modify database -d -y manual
$ srvctl disable asm -n
# crsctl disable crs

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Ref:
How to Convert RAC ASM/DB instances to non-RAC ASM/DB instances (Doc ID 759868.1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1) Verify database running status on all nodes.
[oracle@host01 ~]$ srvctl status database -d RAC
Instance RAC1 is running on node host01
Instance RAC2 is running on node host02

2) Stop database using srvctl

[oracle@host01 ~]$ srvctl stop database -d RAC

3) Remove the database entry from crs

[oracle@host01 ~]$ srvctl remove instance -d RAC -i RAC2
Remove instance RAC2 from the database RAC? (y/[n]) y
[oracle@host01 ~]$ srvctl remove instance -d RAC -i RAC1

Remove instance RAC1 from the database RAC? (y/[n]) y

4) Start the database on first instance

[oracle@host01 ~]$ dba

SQL*Plus: Release 11.1.0.7.0 - Production on Wed Sep 16 20:01:54 2011Copyright (c) 1982, 2008, Oracle.  All rights reserved.Connected to an idle instance.

SQL> startup
ORACLE instance started.
Total System Global Area 2.6724E+10 bytes
Fixed Size      2160272 bytes
Variable Size   1.4764E+10 bytes
Database Buffers  1.1811E+10 bytes
Redo Buffers    146423808 bytes
Database mounted.
Database opened.

SQL> alter system set cluster_database=false scope=spfile;

System altered.

SQL> alter system set cluster_database_instances=1 scope=spfile;

System altered.

SQL> alter database disable thread 2;

Database altered.

5) Delete the unwanted thread and redo logfiles

SQL> select thread#, group# from v$log order by 1;

THREAD# GROUP#
———- ———-
1 5
1 6
1 18
1 16
1 14
1 13
1 10
2 12
2 15
2 11
2 17

THREAD# GROUP#
———- ———-
2 9
2 8
2 7
2 19

15 rows selected.

SQL> alter database drop logfile group 12;

Database altered.

SQL> alter database drop logfile group 15;

Database altered.

SQL> alter database drop logfile group 11;

Database altered.

SQL> alter database drop logfile group 17;

Database altered.

SQL> alter database drop logfile group 9;

Database altered.

SQL> alter database drop logfile group 8;

Database altered.

SQL> alter database drop logfile group 7;

Database altered.

SQL> alter database drop logfile group 19;

Database altered.

SQL> select thread#, group# from v$log order by 1;

THREAD# GROUP#
———- ———-
1 5
1 6
1 10
1 18
1 14
1 16
1 13

7 rows selected.

SQL>

6) Drop the unwanted undo tablespace

SQL> drop tablespace UNDOTBS2 including contents and datafiles;

Tablespace dropped.

7) Create pfile from spfile

SQL> create pfile from spfile;

File created.

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

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, OLAP, Data Miningand Real Application Testing options[oracle@host01 ~]$

8) Remove all references of second instance from the pfile and start the instance using pfile. Later you can again create spfile from pfile.

— removed all RAC2 references.

9) Startup the database and make sure all look good.
[oracle@host01 dbs]$ dba

SQL*Plus: Release 11.1.0.7.0 – Production on Wed Sep 16 20:09:28 2011

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

Connected to an idle instance.

SQL> create spfile from pfile;

File created.

SQL> startup
ORACLE instance started.

Total System Global Area 2.6724E+10 bytes
Fixed Size 2160272 bytes
Variable Size 1.4764E+10 bytes
Database Buffers 1.1811E+10 bytes
Redo Buffers 146423808 bytes
Database mounted.
Database opened.
SQL>

How to enable/disable RAC (ON/OFF)

Use the following steps to disable RAC (known as RAC OFF):

1. Log in as the Oracle software owner (which is typically the UNIX account oracle) in all nodes.
2. Shut down all the instances from all the nodes using a NORMAL or IMMEDIATE option.
3. Change the working directory to $ORACLE_HOME/rdbms/lib: cd $ORACLE_HOME/rdbms/lib
4. Run the following make command to relink the Oracle binaries without the RAC option: make -f ins_rdbms.mk rac_off

This normally runs for few minutes and should not pose any errors.
5. . Now relink the Oracle binaries: make -f ins_rdbms.mk ioracle

Now the Oracle binaries are relinked with the RAC OFF option. You may have to edit the init.ora or SPFILE parameters accordingly. If errors occur in step 4, you may need to contact Oracle Support and log a service request with the trace and log files.

Use the following steps to enable RAC (known as RAC ON):

1. Log in as the Oracle software owner (typically the UNIX account oracle) in all nodes.
2. Shut down all the instances from all the nodes using a NORMAL or IMMEDIATE option.
3. Change the working directory to $ORACLE_HOME/rdbms/lib:
4. cd $ORACLE_HOME/rdbms/lib Run the following make command to relink the Oracle binaries without the RAC option:
make -f ins_rdbms.mk rac_on

This normally runs for a few minutes and should not pose any errors.
5. Now relink the Oracle binaries:
make -f ins_rdbms.mk ioracle

Now the Oracle binaries are relinked with the RAC ON option. You may need to edit the init.ora or SPFILE parameters accordingly. If any errors occur in step 4, you may need to contact Oracle Support and log a service request with the trace and log files.

Sunday, 24 January 2016

Understanding and How To Gather & Backup ASM/ACFS Metadata

1. ASM metadata

An ASM instance manages metadata needed to make ASM files available to Oracle databases and other ASM clients. ASM metadata is stored in the disk groups – in the metadata blocks.

Some ASM metadata is at the fixed position in every ASM disk, and is referred to as physically addressed metadata. Other ASM metadata is organised in files (directories) and is referred to as virtually addressed metadata. The virtually addressed metadata files are managed like any other ASM files – they get mirrored as per the file type redundancy policy, are subject to rebalance and can grow as needed.

Each ASM disk has the metadata that may be relevant to that disk only or to the whole disk group. For example, the ASM disk header is relevant to that disk only, while  the Partnership and Status Table (PST) is relevant to the whole disk group.

2. Physically addressed metadata

The physical ASM metadata are the following structures:

  • Disk header
  • Free Space Table (FST)
  • Allocation Table (AT)
  • Partnership and Status Table (PST)

The disk header, allocation table and free space table are called physically addressed ASM metadata, because ASM instance refers to this data via a disk number and the block number within a disk. The partnership and status table is a special case, as ASM refers to it via allocation unit number, not via disk/block number.

Allocation units 0 on every ASM disk will always have the disk header (block 0), the Free Space Table (block 1) and the Allocation Table - in the rest of the allocation unit 0 blocks.

The ASM disk header contains the disk number, disk group redundancy, disk name, disk group name, disk size, etc.

The Free Space Table (FST) indicates which allocation table blocks may have free space in them. It contains an array of bit patterns indexed by allocation table block number. Location of the first block of the free space table is in the disk header field kfdhdb.fstlocn.

The ASM allocation table (AT) has one entry for every allocation unit (AU) on the disk. Location of the first block of the allocation table is in the disk header – field kfdhdb.altlocn.

The Partnership and Status Table (PST) contains the information about all ASM disks in the disk group – disk numbers, their status, their partner disks, heartbeat info, the failure group info, etc. Each ASM disk contains an allocation unit reserved for storing the PST - typically that is allocation unit number 1. Only few disks have the actual PST data – in external redundancy group we only have one PST table, in a normal redundancy disk group we have up to 3 copies of the PST, and in a high redundancy disk group we have up to 5 copies of the PST.

3. Virtually addressed metadata

The rest of the disk group metadata is organized in ASM metadata files (directories). That is how ASM keeps track of the database files, ASM disks, ASM instance recovery data, etc. An ASM metadata file is maintained like any other file stored in ASM, which means that its extents are allocated across all available disks, that they are mirrored (in a normal and high redundancy disk group) and that its extents can be moved around when the disk group is rebalanced. ASM file numbers between 1 and 255 are reserved for ASM metadata files.
The virtually addressed metadata are the following structures:
  • File Directory
  • Disk Directory
  • Active Change Directory (ACD)
  • Continuing Operations Directory (COD)
  • Template Directory
  • Alias Directory
  • ADVM Volume Directory
  • Disk Used Space Directory
  • Attributes Directory
  • ASM User Directory and User Group Directory
  • Staleness Directory and Staleness Registry
  • Password directory
ASM metadata file names and their locations are not externalized and cannot be queried directly, but we can peek at them via X$KFFXP fixed table. The following query shows the ASM metadata file numbers, their names and allocation unit count for each file in a disk group (in this case in the disk group number 2):
SQL> select
  NUMBER_KFFXP "ASM file number",
  DECODE (NUMBER_KFFXP, 1, 'File directory',
    2, 'Disk directory',
    3, 'Active change directory',
    4, 'Continuing operations directory',
    5, 'Template directory',
    6, 'Alias directory',
    7, 'AVD volume file directory',
    8, 'Disk free space directory',
    9, 'Attributes directory',
    10, 'ASM user directory',
    11, 'ASM user group directory',
    12, 'Staleness directory',
    13, 'Password directory',
    253, 'ASM spfile',
    254, 'Stale bitmap space registry ',
    255, 'Oracle Cluster Repository ')
  "ASM metadata file name",
  count(AU_KFFXP) "Allocation units"
from X$KFFXP
where GROUP_KFFXP = 2    -- disk group 2
  and NUMBER_KFFXP < 256 -- ASM metadata files
group by NUMBER_KFFXP
;

ASM file number ASM metadata file name          Allocation units
--------------- ------------------------------- ----------------
              1 File directory                                 3
              2 Disk directory                                 3
              3 Active change directory                       69
              4 Continuing operations directory                6
              5 Template directory                             3
              6 Alias directory                                3
              8 Disk free space directory                      3
              9 Attributes directory                           3
             12 Staleness directory                            3
            253 ASM spfile                                     2
            254 Stale bitmap space registry                    3
            255 Oracle Cluster Repository                     83

12 rows selected.

SQL>
As we can see, the disk group does not have to have all metadata files.

4. ASM metadata blocks

ASM metadata is organized in ASM blocks, with the default block size of 4KB. Note that ASM blocks are independent and not related to Oracle database blocks or their sizes. An ASM block consists of a common block header and the rest of ASM metadata that would be block type specific.
The following are the ASM metadata block types:
  • KFBTYP_DISKHEAD - The ASM disk header - the very first block in every ASM disk. A copy of this block will be in the second last Partnership and Status Table (PST) block (in ASM version 11.1.0.7 and later). The copy of this block will also be in the very first block in Allocation Unit 11, for disk groups with COMPATIBLE.ASM=12.1 or higher.
  • KFBTYP_FREESPC - The Free Space Table block.
  • KFBTYP_ALLOCTBL - The Allocation Table block.
  • KFBTYP_PST_META - The Partnership and Status Table (PST) block. The PST blocks 0 and 1 will be of this type.
  • KFBTYP_PST_DTA - The PST blocks with the actual PST data.
  • KFBTYP_PST_NONE - The PST block with no PST data. Remember that Allocation Unit 1 (AU1) on every disk is reserved for the PST, but only some disks will have the PST data.
  • KFBTYP_HBEAT - The heartbeat block, in the PST.
  • KFBTYP_FILEDIR - The File Directory block.
  • KFBTYP_INDIRECT - The Indirect File Directory block, containing a pointer to another file directory block.
  • KFBTYP_LISTHEAD - The Disk Directory block. The very first block in the ASM disk directory. The field kfdhdb.f1b1locn in the ASM disk header will point the the allocation unit whose block 0 will be of this type.
  • KFBTYP_DISKDIR - The rest of the blocks in the Disk Directory will be of this type.
  • KFBTYP_ACDC - The Active Change Directory (ACD) block. The very first block of the ACD will be of this type.
  • KFBTYP_CHNGDIR - The blocks with the actual ACD data.
  • KFBTYP_COD_BGO - The Continuing Operations Directory (COD) block for background operations data.
  • KFBTYP_COD_RBO - The COD block that marks the rollback operations data.
  • KFBTYP_COD_DATA - The COD block with the actual rollback operations data.
  • KFBTYP_TMPLTDIR - The Template Directory block.
  • KFBTYP_ALIASDIR - The Alias Directory block.
  • KFBTYP_SR - The Staleness Registry block.
  • KFBTYP_STALEDIR - The Staleness Directory block.
  • KFBTYP_VOLUMEDIR -The ADVM Volume Directory block.
  • KFBTYP_ATTRDIR -The Attributes Directory block.
  • KFBTYP_USERDIR - The User Directory block.
  • KFBTYP_GROUPDIR - The User Group Directory block.
  • KFBTYP_USEDSPC - The Disk Used Space Directory block.
  • KFBTYP_ASMSPFALS -The ASM spfile alias block.
  • KFBTYP_PASWDDIR - The ASM Password Directory block.
  • KFBTYP_INVALID - Not an ASM metadata block.
Note that the KFBTYP_INVALID is not an actual block type stored in ASM metadata block. Instead, ASM will return this if it encounters a block where the type is not one of the valid ASM metadata block types. For example if the ASM disk header is corrupt, say zeroed out, ASM will report it as KFBTYP_INVALID. We will also see the same when reading such block with the kfed tool.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1) Connect to your ASM instance(s) and execute the first 3 scripts below (on each node if this is RAC configuration).

2) Also, execute the script #4  (located below) through ASMCMD to gather complementary metadata information (on each node if this is RAC configuration)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Script #1 (Generic ASM metadata):

SPOOL ASM<#>_GENERIC_ASM_METADATA.html
-- ASM VERSIONS 10.1, 10.2, 11.1,  11.2 & 12.1
SET MARKUP HTML ON
SET ECHO ON

SET PAGESIZE 200

ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';

SELECT 'THIS ASM REPORT WAS GENERATED AT: ==)> ' , SYSDATE " "  FROM DUAL;
SELECT 'INSTANCE NAME: ==)> ' , INSTANCE_NAME " " FROM V$INSTANCE;

SELECT 'HOSTNAME ASSOCIATED WITH THIS ASM INSTANCE: ==)> ' , MACHINE " " FROM V$SESSION WHERE PROGRAM LIKE '%SMON%';

SELECT * FROM V$INSTANCE;

SELECT * FROM GV$INSTANCE;

SELECT * FROM V$ASM_DISKGROUP;

SELECT * FROM  V$ASM_DISK ORDER BY GROUP_NUMBER,DISK_NUMBER;

SELECT SUBSTR(D.NAME,1,16) AS ASMDISK, D.MOUNT_STATUS, D.STATE,
     DG.NAME AS DISKGROUP FROM V$ASM_DISKGROUP DG, V$ASM_DISK D
     WHERE DG.GROUP_NUMBER = D.GROUP_NUMBER;


SELECT * FROM V$ASM_CLIENT;

 SELECT DG.NAME AS DISKGROUP, SUBSTR(C.INSTANCE_NAME,1,12) AS INSTANCE,
    SUBSTR(C.DB_NAME,1,12) AS DBNAME, SUBSTR(C.SOFTWARE_VERSION,1,12) AS SOFTWARE,
    SUBSTR(C.COMPATIBLE_VERSION,1,12) AS COMPATIBLE
    FROM V$ASM_DISKGROUP DG, V$ASM_CLIENT C
    WHERE DG.GROUP_NUMBER = C.GROUP_NUMBER;

SELECT * FROM V$ASM_ATTRIBUTE;

SELECT * FROM V$ASM_OPERATION;
SELECT * FROM GV$ASM_OPERATION;


SELECT * FROM V$VERSION;


SELECT * FROM   V$ASM_ACFSSNAPSHOTS;
SELECT * FROM   V$ASM_ACFSVOLUMES;
SELECT * FROM   V$ASM_FILESYSTEM;
SELECT * FROM   V$ASM_VOLUME;
SELECT * FROM   V$ASM_VOLUME_STAT;

SELECT * FROM   V$ASM_USER;
SELECT * FROM   V$ASM_USERGROUP;
SELECT * FROM   V$ASM_USERGROUP_MEMBER;

SELECT * FROM   V$ASM_DISK_IOSTAT;
SELECT * FROM   V$ASM_DISK_STAT;
SELECT * FROM   V$ASM_DISKGROUP_STAT;

SELECT * FROM   V$ASM_TEMPLATE;

SHOW PARAMETER

SHOW SGA

!echo "SELECT '" > /tmp/GPNPTOOL.SQL 2> /dev/null
! $ORACLE_HOME/bin/gpnptool get >> /tmp/GPNPTOOL.SQL 2>> /dev/null
!echo "'  FROM DUAL;" >> /tmp/GPNPTOOL.SQL 2>> /dev/null
! cat /tmp/GPNPTOOL.SQL
SET ECHO OFF

--DISPLAYS INFORMATION ABOUT THE CONTENTS OF THE SPFILE.
SELECT *  FROM  V$SPPARAMETER  ORDER BY 2;
SELECT *  FROM  GV$SPPARAMETER  ORDER BY 3;

--DISPLAYS INFORMATION ABOUT THE INITIALIZATION PARAMETERS THAT ARE CURRENTLY IN EFFECT IN THE INSTANCE.
SELECT *  FROM  V$SYSTEM_PARAMETER ORDER BY 2;
SELECT *  FROM  GV$SYSTEM_PARAMETER ORDER BY 3;


-- 12C ACFS VIEWS

SELECT * FROM  V$ASM_ACFS_ENCRYPTION_INFO;
SELECT * FROM  V$ASM_ACFSREPL;
SELECT * FROM  V$ASM_ACFSREPLTAG;
SELECT * FROM  V$ASM_ACFS_SEC_ADMIN;
SELECT * FROM  V$ASM_ACFS_SEC_CMDRULE;
SELECT * FROM  V$ASM_ACFS_SEC_REALM;
SELECT * FROM  V$ASM_ACFS_SEC_REALM_FILTER;
SELECT * FROM  V$ASM_ACFS_SEC_REALM_GROUP;
SELECT * FROM  V$ASM_ACFS_SEC_REALM_USER;
SELECT * FROM  V$ASM_ACFS_SEC_RULE;
SELECT * FROM  V$ASM_ACFS_SEC_RULESET;
SELECT * FROM  V$ASM_ACFS_SEC_RULESET_RULE;
SELECT * FROM  V$ASM_ACFS_SECURITY_INFO;
SELECT * FROM  V$ASM_ACFSTAG;

-- 12C ASM AUDIT VIEWS

SELECT * FROM  V$ASM_AUDIT_CLEAN_EVENTS;
SELECT * FROM  V$ASM_AUDIT_CLEANUP_JOBS;
SELECT * FROM  V$ASM_AUDIT_CONFIG_PARAMS;
SELECT * FROM  V$ASM_AUDIT_LAST_ARCH_TS;

-- 12C ASM ESTIMATE VIEW

SELECT * FROM  V$ASM_ESTIMATE;
SELECT * FROM  GV$ASM_ESTIMATE;


SPOOL OFF

EXIT

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Script #2 (ASM Files & ASM Alias):


 spool asm<#>_alias+files.html
-- ASM Versions 10.1, 10.2, 11.1,  11.2 & 12.1
SET MARKUP HTML ON
set echo on

set pagesize 200

COLUMN BYTES FORMAT  9999999999999999

alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';

select 'THIS ASM REPORT WAS GENERATED AT: ==)> ' , sysdate " "  from dual;


select 'HOSTNAME ASSOCIATED WITH THIS ASM INSTANCE: ==)> ' , MACHINE " " from v$session where program like '%SMON%';

select * from v$asm_alias;

select * from v$asm_file;

show parameter asm
show parameter cluster
show parameter instance_type
show parameter instance_name
show parameter spfile

show sga

spool off

exit

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Script #3 (ASM Full Path Alias Directory):

spool asm<#>_full_path_alias_directory.html
-- ASM Versions 10.1, 10.2, 11.1,  11.2 & 12.1
SET MARKUP HTML ON
set echo on

set pagesize 200

alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';

select 'THIS ASM REPORT WAS GENERATED AT: ==)> ' , sysdate " "  from dual;


select 'HOSTNAME ASSOCIATED WITH THIS ASM INSTANCE: ==)> ' , MACHINE " " from v$session where program like '%SMON%';

SELECT CONCAT('+'||GNAME, SYS_CONNECT_BY_PATH(ANAME, '/'))
 FULL_PATH, SYSTEM_CREATED, ALIAS_DIRECTORY, FILE_TYPE
 FROM ( SELECT B.NAME GNAME, A.PARENT_INDEX PINDEX,
 A.NAME ANAME, A.REFERENCE_INDEX RINDEX,
 A.SYSTEM_CREATED, A.ALIAS_DIRECTORY,
 C.TYPE FILE_TYPE
 FROM V$ASM_ALIAS A, V$ASM_DISKGROUP B, V$ASM_FILE C
 WHERE A.GROUP_NUMBER = B.GROUP_NUMBER
 AND A.GROUP_NUMBER = C.GROUP_NUMBER(+)
 AND A.FILE_NUMBER = C.FILE_NUMBER(+)
 AND A.FILE_INCARNATION = C.INCARNATION(+)
 )
 START WITH (MOD(PINDEX, POWER(2, 24))) = 0
 CONNECT BY PRIOR RINDEX = PINDEX;


spool off

exit

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Script #4 (ASMCMD commands to gather complementary metadata information):


################################################################################################
### Script Name:  asmcmd_script.sh                                                                                     ###   
################################################################################################
###  The next script generates additional ASM metadata information thru the ASMCMD interface ###
################################################################################################
###  Author: Esteban D. Bernal                                                               ###
################################################################################################
###  Property: Oracle Corporation                                                            ###
################################################################################################


echo "ASMCMD commands to gather complementary metadata information:"    > /tmp/asmcmd_script.out                2> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p ls -ls        >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p lsattr        >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p lsct  >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p lsdg  >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p lsdsk >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p lsof  >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p lsod  >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p iostat        >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p dsget >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p lsop  >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p spget >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p  lstmpl       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p   lsusr       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p  lsgrp        >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p   lspwusr     >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
asmcmd -p   volinfo -a  >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "=================================="       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
echo "                                  "       >> /tmp/asmcmd_script.out               2>> /tmp/asmcmd_script.out
##############################################################################################################

Note: On Windows environments the “2> /tmp/asmcmd_script.out” or “2>> /tmp/asmcmd_script.out” statements is not required, thus it can be omitted.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[grid@node02 ~]$ . oraenv
ORACLE_SID = [+ASM] ? +ASM
The Oracle base remains unchanged with value /u01/app/grid
[grid@node02 ~]$
[grid@node02 ~]$ ./asmcmd_script.sh
[grid@node02 ~]$


Output file:

[grid@node02 ~]$ ls -l /tmp/asmcmd_script.out
-rw-r--r-- 1 grid oinstall 15873 Nov  6 11:03 /tmp/asmcmd_script.out


 Ref: