Sunday, February 10, 2019

Convert NON-Partitioned table into Partitioned table in oracle

Convert NON-Partitioned table into Partitioned table in oracle

This is one of the new feature of oracle 12.2 release .

Non-partitioned tables can be converted to partitioned table online without any downtime to the application , i.e no impact to the DML activities.

Till now for this activity, we were using dbms_redef methods. But in Oracle 12.2 release this has been simplified much.


See the below example:

1. Identify the non partitioned table.






 2. Alter table modify to partition the table.( partition key is column CREATED )

This activity will take some time depending upon amount of data table has.

While this alter statement is running, I have started running DML activities on the same table, To check whether it is impacting the DML activities.



SESSION 2:


We can see that the insert statement(SID 7), is blocking the alter table command(SID 490), not the other way around. It means during this partition conversion activity, if any DML requests are coming, then it will allow them to complete their request. This may slow down the partition conversion time, But it won’t impact the application. Once ALTER TABLE MODIFY is completed. Check the whether table was partitioned properly or not.



But what happened to the INDEXES:


We can see PART_TEST_TABLE_IND1 was NON partitioned, But PART_TEST_TABLE_IND2 was partitioned.



Oracle document Says:

If no index clause is mentioned in the alter table statement, then

nonprefixed indexes(i.e index column is not a partitioned key) will be become global non-partitioned Index.
prefixed indexes(i.e index column is a partitioned key) will become local partitioned Index.




It is an nonprefixed Index i.e index column is not a partitioned key. So it became global non partitioned Index


PART_TEST_TABLE_IND2  -
--------------------



It is an prefixed Index.  i.e index column in a partitione key .
So this indexes became local partitioned Index.


There are lot of 12.2 New features like moving a table online, Spliting a partitioned table online etc. which we will discuss very soon.





Thursday, January 4, 2018

ora-00439 feature not enabled partitioning standard edition

ora-00439 feature not enabled partitioning standard edition


select * from v$option where parameter = 'Partitioning';


When you select the “Enterprise Edition” option during Oracle installation, all the components which are licensed under “Enterprise Edition” get installed by default.

If you need additional functionality such as partitioning some time after the initial installation, you can enable (or disable) the specific component functionality at the binary level:

1. Shutdown all database instance(s)/service(s) running from the Oracle Database Home
2. Run the following relink command to disable the option at the binary level:

#######################################################
below command use for turn off partitioning
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

make -f ins_rdbms.mk option_switch ioracle

cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk part_off ioracle



below command use for turn on partitioning
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$ cd $ORACLE_HOME/rdbms/lib
$ make -f ins_rdbms.mk part_on
$ make -f ins_rdbms.mk ioracle


Here is the list of database options and switches:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




3. Startup the instance and check if the option is enabled:

Oracle PL/SQL

SELECT * FROM v$option WHERE parameter = 'Partitioning';






Remove the Database From an RMAN Recovery Catalog

Remove the  Database From an RMAN Recovery  Catalog
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Removing the database from catalog is nothing but unregisterring the database from the catalog, below methods will help to unregister the database.


There are multiple ways to unregister a database from an RMAN recovery catalog.


UNREGISTER DATABASE (Catalog and Database)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This option is available from Oracle 10g onward. If you still have access to the database you can start RMAN, connecting to both the target database and the catalog.

rman target=sys/password@DBNAME  catalog=rman/rman@catdb

Below are optional, if you want to perform any cleaning operations, you can use below.

RMAN> LIST BACKUP SUMMARY;
RMAN> DELETE BACKUP DEVICE TYPE SBT;
RMAN> DELETE BACKUP DEVICE TYPE DISK;

then

RMAN> UNREGISTER DATABASE;

OR

RMAN> UNREGISTER DATABASE NOPROMPT;



UNREGISTER DATABASE (Catalog Only)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This option is available from Oracle 10g onward. If you no longer have access to the target database, you can still unregister it from the catalog using the UNREGISTER DATABASE command in RMAN.

Start RMAN, connecting only to the catalog.

rman catalog=rman/rman@catdb
Unregister the database by name.

RMAN> UNREGISTER DATABASE SAMPLE NOPROMPT;



If there is more than one database in the catalog with the same name, you will need to use the DBID to identify the database to unregister. You can find this using the LIST INCARNATION command.

RMAN> LIST INCARNATION OF DATABASE SAMPLE;
Once you have the DBID, you can unregister the database using the following script.

RUN
{ 
  SET DBID 152565859654;
  UNREGISTER DATABASE SAMPLE NOPROMPT;
}



DBMS_RCVCAT (Catalog Only)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you no longer have access to the target database, you can still unregister it from the catalog using the DBMS_RCVCAT package in SQL.

Connect to the catalog database using SQL*Plus, then query the DB_KEY and DBID values as follows.

SQL> CONNECT rman/rman@catdb
Connected.

SQL> SELECT db_key, dbid, name FROM rc_database WHERE name = 'SAMPLE';

    DB_KEY       DBID NAME
---------- ---------- --------
     23085 152565859654 SAMPLE

1 row selected.


SQL>

The resulting DB_KEY and DBID can then be used to unregister the database using the DBMS_RCVCAT package.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(23085 , 152565859654 );

PL/SQL procedure successfully completed.

SQL>


Unregister a Database From an RMAN Recovery Catalog

Unregister a Database From an RMAN Recovery Catalog
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There are multiple ways to unregister a database from an RMAN recovery catalog.


UNREGISTER DATABASE (Catalog and Database)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This option is available from Oracle 10g onward. If you still have access to the database you can start RMAN, connecting to both the target database and the catalog.

rman target=sys/password@SAMPLE catalog=rman/rman@catdb

Below are optional, if you want to perform any cleaning operations, you can use below.

RMAN> LIST BACKUP SUMMARY;
RMAN> DELETE BACKUP DEVICE TYPE SBT;
RMAN> DELETE BACKUP DEVICE TYPE DISK;

then

RMAN> UNREGISTER DATABASE;

OR

RMAN> UNREGISTER DATABASE NOPROMPT;



UNREGISTER DATABASE (Catalog Only)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This option is available from Oracle 10g onward. If you no longer have access to the target database, you can still unregister it from the catalog using the UNREGISTER DATABASE command in RMAN.

Start RMAN, connecting only to the catalog.

rman catalog=rman/rman@catdb
Unregister the database by name.

RMAN> UNREGISTER DATABASE SAMPLE NOPROMPT;



If there is more than one database in the catalog with the same name, you will need to use the DBID to identify the database to unregister. You can find this using the LIST INCARNATION command.

RMAN> LIST INCARNATION OF DATABASE SAMPLE;
Once you have the DBID, you can unregister the database using the following script.

RUN
{
  SET DBID 152565859654;
  UNREGISTER DATABASE SAMPLE NOPROMPT;
}



DBMS_RCVCAT (Catalog Only)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you no longer have access to the target database, you can still unregister it from the catalog using the DBMS_RCVCAT package in SQL.

Connect to the catalog database using SQL*Plus, then query the DB_KEY and DBID values as follows.

SQL> CONNECT rman/rman@catdb
Connected.

SQL> SELECT db_key, dbid, name FROM rc_database WHERE name = 'SAMPLE';

    DB_KEY       DBID NAME
---------- ---------- --------
     23085 152565859654 SAMPLE

1 row selected.


SQL>

The resulting DB_KEY and DBID can then be used to unregister the database using the DBMS_RCVCAT package.

SQL> EXECUTE dbms_rcvcat.unregisterdatabase(23085 , 152565859654 );

PL/SQL procedure successfully completed.

SQL>



Clean UNINSTALL the oracle binaries from WINDOWS

Clean UNINSTALL the oracle binaries from WINDOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Below steps is use to do the clean UNINSTALL the oracle binaries on WINDOWS



Uninstall all Oracle components using the Oracle Universal Installer (OUI).
1. Delete the HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE key which contains registry entries for all Oracle products by using regedit.

2. Delete any references to Oracle services/components in the following registry location: HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/. Looks for key entries that starts with “Ora” which are obviously related to Oracle.

3. Reboot the workstation.

4. Delete the ORACLE_BASE directory. (i.e C:\Oracle)

5. Delete the C:\Program Files\Oracle directory.

6.Empty the temp directory.

7.Empty the recycle bin.


Warning: Editing registry may cause problems to your PC.