Wednesday, December 5, 2018

Undo tablespace sizing


Undo tablespace sizing

It's tricky because you cannot shrink the current undo log, you can only shrink those undo files that are not currently in-use.

You can shrink the datafile of the UNDO tablespace on the primary database to 5G by using the following command:

alter database
   datafile '/ou1/app/oracley/undo_ts01.dbf' 
   resize 2G;


You must Supply the correct file name in the above command.

If you get this error:

ORA-03297: file contains used data beyond requested RESIZE value

This ORA-03297 error says that only space can be released if it is at the end of the datafile. The undo segments may be scattered all over the UNDO datafile.

In this case you have to do the following on the  database:

1) Create new undo tablespace with smaller size.

SQL> create undo tablespace UNDO_tbs1 datafile 'undorbs1.dbf' size 2G;

2)Set the new tablespace as an undo_tablespace

SQL> alter system set undo_tablespace=undo_tbs1;

3) Drop the old tablespace.

SQL> drop tablespace undo_tbs0 including contents.

Note-- Dropping the old tablespace may give the ORA-30013 : undo tablespace '%s' is currently in use. This error indicates you must wait for the undo tablespace to become unavailable. In other words, you must wait for existing transaction to commit or rollback.


Sunday, December 2, 2018

How to Move From the Standard Edition to the Enterprise Edition.


How to Move From the Standard Edition to the Enterprise Edition.

If you are using the Standard Edition of the Oracle Database and want to move to the Enterprise Edition, then complete the following steps:

Ensure that the release number of your Standard Edition server software is the same release as the Enterprise Edition server software.

For example, if your Standard Edition server software is release 12.1.0.2, then you should upgrade to release 12.1.0.2 of the Enterprise Edition.

• Backup the database.

 Make a backup copy of files under $Oracle_Home/network/admin. This ensures that the listener is  configured after you complete the steps in this procedure.

 Back up all database files under the current Oracle home that you need to keep.

 On Linux, back up $Oracle_Home/dbs/.
 On Windows, back up $Oracle_Home/database/.

• Shut down your database.

If your operating system is Windows, then stop all Oracle services, including the OracleServiceSID Oracle service, where SID is the instance name.

• Deinstall the Standard Edition server software.

• Install the Enterprise Edition server software using the Oracle Universal Installer.

• Select the same Oracle home that was used for the de-installed Standard Edition. During the installation, be sure to select the Enterprise Edition.

• When prompted, choose Software Only from the Database Configuration screen.

• Start up your database.

Your database is now upgraded to the Enterprise Edition.
You can verify it from the banner:

SQL> select banner from v$version;

BANNER
——————————————————————————–
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
PL/SQL Release 12.1.0.2.0 – Production
CORE 12.1.0.2.0 Production
TNS for Linux: Version 12.1.0.2.0 – Production
NLSRTL Version 12.1.0.2.0 – Production

How to create user in MY SQL

Create  a new MySQL user Account mysql > CREATE USER ' newuser '@'localhost' IDENTIFIED BY ' password '...