Oracle Database

ORA-19527: physical standby redo log must be renamed

On standby side, you may encountered the Error “ORA-19527: physical standby redo log must be renamed” in the alert log.

ORA-19527: physical standby redo log must be renamed
ORA-00312: online log 10 thread 1: '/u01/oradata/dev12c/std_redo03.log'

Though this didn’t stop the data guard replication, we need to get rid of this error message. It seems to be false alarm in DR alert log.

Solution: If there is no difference in the directory structure in Primary and standby, you can get rid of this message by modifying the log_file_name_convert parameter to a dummy Value

ALTER SYSTEM SET log_file_name_convert='dummy','dummy';

After the parameter was set, the ORA message was no longer seen in the alert.log

Reference: ORA-19527: Physical Standby Redo Log Must Be Renamed…during switchover (Doc ID 2194825.1)

ORA-65093: multitenant container database not set up properly

While starting a container database or mounting a standby container database you may encountered Error: ORA-65093: multitenant container database not set up properly

RMAN-11003: failure during parse/execution of SQL statement: alter database mount standby database
ORA-65093: multitenant container database not set up properly

Solution is add the parameter enable_pluggable_database=true and restart the instance,

enable_pluggable_database=true

Hope this helps…

Enable Flashback Database on Oracle 12c

In this article we will describe the step by step instructions on how to enable flashback on Oracle 12c database

  1. Enable ARCHIVELOG mode:
SQL> select log_mode from v$database;

LOG_MODE
------------
NOARCHIVELOG

If the database is in NOARCHIVELOG mode, Enable it

alter system set log_archive_dest_1='LOCATION=/u01/app/oracle/arch';
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;

Check the Database ARCHIVELOG status

SQL> select log_mode from v$database;

LOG_MODE
------------
ARCHIVELOG

2. Set the DB_RECOVERY_FILE_DEST_SIZE and DB_RECOVERY_FILE_DEST

alter system set DB_RECOVERY_FILE_DEST_SIZE=10G;
alter system set DB_RECOVERY_FILE_DEST='/u01/app/oracle/fra';

3. Enable FLASHBACK database

ALTER DATABASE FLASHBACK ON;

4. Check the FLASHBACK database status

SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
YES

Hope this helps..

ORA-19802: cannot use DB_RECOVERY_FILE_DEST without DB_RECOVERY_FILE_DEST_SIZE

You might encounter ORA-19802 error while setting DB_RECOVERY_FILE_DEST

Error:

SQL> alter system set db_recovery_file_dest='/u01/app/oracle/fra';
alter system set db_recovery_file_dest='/u01/app/oracle/fra'
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-19802: cannot use DB_RECOVERY_FILE_DEST without DB_RECOVERY_FILE_DEST_SIZE

Solution:

First set the DB_RECOVERY_FILE_DEST_SIZE parameter, then set the DB_RECOVERY_FILE_DEST

SQL> alter system set DB_RECOVERY_FILE_DEST_SIZE=10G;

System altered.

SQL> alter system set DB_RECOVERY_FILE_DEST='/u01/app/oracle/fra';

System altered.

ORA-16179: incremental changes to “log_archive_dest_1” not allowed with SPFILE

You might encounter ORA-16179 error during updating the archive log destination.

Error Details:

SQL> alter system set log_archive_dest_1='/u01/app/oracle/arch';
alter system set log_archive_dest_1='/u01/app/oracle/arch'
*
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-16179: incremental changes to "log_archive_dest_1" not allowed with SPFILE

Solution:

SQL> alter system set log_archive_dest_1='LOCATION=/u01/app/oracle/arch';

System altered.

Migrate ASM Diskgroup to another storage

ASM Storage migration

In this post I will describe in step by step how to Migrate Oracle ASM Diskgroups to another Storage in Online mode without downtime.

In my Case here I am migrating all 3 data disks (DISK01, DISK02, DISK03) to new storage:

NAME                           PATH                   TOTAL_MB 
------------------------------ -------------------- ----------
DISK01                         ORCL:DISK01               20000     --> OLD
DISK02                         ORCL:DISK02               20001     --> OLD
DISK03                         ORCL:DISK03               10001     --> OLD
DISKNEW01                      ORCL:DISKNEW01            20479     --> NEW
DISKNEW02                      ORCL:DISKNEW02            20479     --> NEW
DISKNEW03                      ORCL:DISKNEW03            10239     --> NEW
1. Backup the database using RMAN and validate the Backups

Take an RMAN backups and validate the backups

2. Add storage luns to database nodes and Partition the disks

In my case 3 disks are added.

/dev/sdc - 20G
/dev/sdd - 20G
/dev/sde- 10G

Partition the disks

fdisk  /dev/sdc
fdisk  /dev/sdd
fdisk  /dev/sde
Sample output:

[root@oracle01 tmp]# fdisk  /dev/sdd1
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x28cbe8a9.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-51200, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-51200, default 51200): +20000M
3. Add the newly created disks to ASM
oracleasm createdisk DISKNEW01 /dev/sdc1
oracleasm createdisk DISKNEW02 /dev/sdd1
oracleasm createdisk DISKNEW03 /dev/sde1
--list the disks
oracleasm listdisks
output:
	
	[root@oracle01 ~]# oracleasm createdisk DISKNEW01 /dev/sdc1
	Writing disk header: done
	Instantiating disk: done
	[root@oracle01 ~]#
	[root@oracle01 ~]# oracleasm createdisk DISKNEW01 /dev/sdd1
	Disk "DISKNEW01" already exists
	[root@oracle01 ~]# oracleasm createdisk DISKNEW02 /dev/sdd1
	Writing disk header: done
	Instantiating disk: done
	[root@oracle01 ~]#
	[root@oracle01 ~]#
	[root@oracle01 ~]# oracleasm createdisk DISKNEW03 /dev/sde1
	Writing disk header: done
	Instantiating disk: done
	[root@oracle01 ~]#
	[root@oracle01 ~]# oracleasm listdisks
	DISK01
	DISK02
	DISK03
	DISKNEW01
	DISKNEW02
	DISKNEW03
	
4. Add new disks to existing diskgroup

Connect to grid user and connect sqlplus as /as sysasm

su - grid
sqlplus / as sysasm

Alter the diskgroup to add new disks and wait until the rebalace operation is completed

alter diskgroup DATA add disk
'ORCL:DISKNEW01',
'ORCL:DISKNEW02',
'ORCL:DISKNEW03' rebalance power 11;
Output:
SQL> alter diskgroup DATA add disk
'ORCL:DISKNEW01',
'ORCL:DISKNEW02',
'ORCL:DISKNEW03' rebalance power 11;  2    3    4


Diskgroup altered.

Query to check the rebalance operation:

select * from v$asm_operation;
select * from gv$asm_operation;

verify the newly added disks

SQL>  select name,path, total_mb, state, mount_status, header_status from v$asm_disk;

NAME                           PATH                   TOTAL_MB STATE    MOUNT_S HEADER_STATU
------------------------------ -------------------- ---------- -------- ------- ------------
DISK01                         ORCL:DISK01               20000 NORMAL   CACHED  MEMBER
DISK02                         ORCL:DISK02               20001 NORMAL   CACHED  MEMBER
DISK03                         ORCL:DISK03               10001 NORMAL   CACHED  MEMBER
DISKNEW01                      ORCL:DISKNEW01            20479 NORMAL   CACHED  MEMBER
DISKNEW02                      ORCL:DISKNEW02            20479 NORMAL   CACHED  MEMBER
DISKNEW03                      ORCL:DISKNEW03            10239 NORMAL   CACHED  MEMBER

6 rows selected.

SQL> select name, total_mb, state, type from v$asm_diskgroup;

NAME                             TOTAL_MB STATE       TYPE
------------------------------ ---------- ----------- ------
DATA                               101199 MOUNTED     EXTERN
5. Remove the old disks from the diskgroup

alter diskgroup DATA drop disk
'DISK01',
'DISK02',
'DISK03' rebalance power 11;

Then wait until the rebalance operation completed,

select * from v$asm_operation;
select * from gv$asm_operation;
output:
SQL> select * from gv$asm_operation;

   INST_ID GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK EST_RATE   EST_MINUTES ERROR_CODE
---------- ------------ ----- ---- ---------- ---------- ---------- ---------- ---------- ----------- --------------------------------------------
         2            1 REBAL WAIT         11										


         1            1 REBAL RUN          11         11       1070       1155      5798           0    

Verify the disk status after the operation completes:

SQL>  select name,path, total_mb, state, mount_status, header_status from v$asm_disk;
SQL> set linesize 200
SQL> set pagesize 200
SQL> col path for a30


NAME                           PATH                             TOTAL_MB STATE    MOUNT_S HEADER_STATU
------------------------------ ------------------------------ ---------- -------- ------- ------------
                               ORCL:DISK01                             0 NORMAL   CLOSED  FORMER
                               ORCL:DISK02                             0 NORMAL   CLOSED  FORMER
                               ORCL:DISK03                             0 NORMAL   CLOSED  FORMER
DISKNEW01                      ORCL:DISKNEW01                      20479 NORMAL   CACHED  MEMBER
DISKNEW02                      ORCL:DISKNEW02                      20479 NORMAL   CACHED  MEMBER
DISKNEW03                      ORCL:DISKNEW03                      10239 NORMAL   CACHED  MEMBER


SQL> select name, total_mb, state, type from v$asm_diskgroup;

NAME                             TOTAL_MB STATE       TYPE
------------------------------ ---------- ----------- ------
DATA                                51197 MOUNTED     EXTERN

6. Now delete the disk from ASM and release the storage

List the disks

[grid@oracle01 ~]$ oracleasm listdisks;
DISK01
DISK02
DISK03
DISKNEW01
DISKNEW02
DISKNEW03

Delete the disk from ASM

oracleasm deletedisk DISK01
oracleasm deletedisk DISK02
oracleasm deletedisk DISK03

output:
[root@oracle01 ~]# oracleasm deletedisk DISK01
Clearing disk header: done
Dropping disk: done
[root@oracle01 ~]# oracleasm deletedisk DISK02
Clearing disk header: done
Dropping disk: done
[root@oracle01 ~]# oracleasm deletedisk DISK03
Clearing disk header: done
Dropping disk: done

List the disks

[root@oracle01 ~]# oracleasm listdisks;
DISKNEW01
DISKNEW02
DISKNEW03

Hope this helps…

Thanks for reading my post.

Create a pluggable database manually in Oracle 12c

create pdb manually

Oracle has introduced new Multitenant Option from Oracle 12cR1 and this option allows a single container database (CDB) to host multiple pluggable databases.

Related articles:

Create Container Database (CDB) in Oracle 12c using DBCA
Create Container database (CDB) in silent mode
Drop a container database in silent mode

In this post I will describe how to create a pluggable database (PDB) from seed. We will cover the following steps:

  1. Create a directory to store new PDB datafiles
  2. Create PDB database using SQL*PLUS
  3. Check the newly created PDB status
  4. Open the PDB database
1. Create a directory to store new PDB Datafiles
mkdir /u01/app/oracle/oradata/cdb2/pdb2
2. Create PDB database using SQL*PLUS
CREATE PLUGGABLE DATABASE pdb2 
ADMIN USER admin_user IDENTIFIED BY Oracle_#123
CREATE_FILE_DEST='/u01/app/oracle/oradata/cdb2/pdb2';

Output:

SQL> CREATE PLUGGABLE DATABASE pdb2
  2  ADMIN USER admin_user IDENTIFIED BY Oracle_#123
  3  CREATE_FILE_DEST='/u01/app/oracle/oradata/cdb2/pdb2';

Pluggable database created.

SQL>
3. Check the newly created pdb status

Status of the PDBs can be checked using v$pdbs view,

select name, open_mode from v$pdbs;
show pdbs;

SQL> select name, open_mode from v$pdbs;

NAME            OPEN_MODE
--------------- ----------
PDB$SEED        READ ONLY
PDB1            READ WRITE
PDB2            MOUNTED

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
         4 PDB2                           MOUNTED
SQL>
4. Open the PDB database in read-write mode
alter pluggable database pdb2 open;
select name, open_mode from v$pdbs;

Output:

SQL> alter pluggable database pdb2 open;

Pluggable database altered.

SQL> select name, open_mode from v$pdbs;

NAME            OPEN_MODE
--------------- ----------
PDB$SEED        READ ONLY
PDB1            READ WRITE
PDB2            READ WRITE

We have created a new PDB pdb2 from seed database and opened it in read-write mode.

Hope this helps…

Oracle 19c database installation on Linux

19c database installation

Description:

In this post I will describe the step by step installation of Oracle database 19c 64-bit on Oracle Linux 7 64-bit and creation of a single instance 19c database.

We will be covering the following steps:

  1. Oracle Database Installation Prerequisites
  2. Installation of Oracle 19.3.0.0 binaries
  3. Creation of single instance database

Download the software binaries from the below link:
https://www.oracle.com/database/technologies/oracle19c-linux-downloads.html

1. Oracle Database Installation Prerequisites

Start a terminal session and enter the following command as root:

# yum install oracle-database-preinstall-19c

Create the directories where Oracle binaries has to be installed:

# mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1
# chown -R oracle:oinstall /u01
# chmod -R 775 /u01

Set the environment variables:
Edit /home/oracle/.bash_profile and add the below lines,

# Oracle ENV Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_UNQNAME=db19c
export ORACLE_SID=db19c
export PDB_NAME=pdb1
export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

Unzip the database binary software:
Switch to ORACLE_HOME directory and unzip the database binary software,


# cd $ORACLE_HOME
# unzip /u01/software/db-soft/LINUX.X64_193000_db_home.zip

2. Installation of Oracle 19.3.0.0 binaries

Log into the oracle user and set the environment variables.

Here I am using VNC viewer to do the installation in graphical mode. Refer the link to Install and configure VNC Server on Linux 7

# cd /home/oracle
# . .bash_profile
# cd $ORACLE_HOME
# ./runInstaller

Click on Set Up Software only

Select the Single instance database installation

Choose Enterprise Edition

Verify the ORACLE_BASE and ORACLE_HOME locations

Select the OS Groups for the installation

Uncheck the Automatically run configuration scripts, Here we will do this manually

Verify the prerequisite output

Install the missing packages and click on Check again

# yum install kmod-20-21*
# yum install kmod-libs-20-21*

Check Summary and click on Install

Run root.sh script as root user

Database binary installation completed.

3. Creation of single instance database using DBCA

Login to oracle user run dbca. The dbca utility is typically located in ORACLE_HOME/bin directory.

Choose Create a database

Select Advance configuration, In Advanced configuration, you can customize storage locations, management database options, and different passwords for Admin user accounts.

Choose Database type: Oracle single instance database and General Purpose or Transaction Processing template

Provide the Global database name & SID
Enable Create as Container database and provide the PDB name

Choose File System and Provide the Database files location details

Enable Specify Fast Recovery Area and provide the location and size

If no listener is available, create a new one

Data Vault Option,

Choose Automatic Memory Management (if your physical memory is less than 4 GB) and Provide the Memory Target.

Note: If the total physical memory of your database instance is greater than 4 GB, then you cannot select the Use Automatic Memory Management option. Instead, use automatic shared memory management.

Specify the Processes count, This will be the maximum number of processes that can simultaneously connect to the database.

Use Unicode (AL32UTF8) Select this option to support multiple languages for your database users and database applications

Management Option

specify the passwords for the administrative accounts such as SYSSYSTEM, and PDBADMIN.

Choose Create database and and click on Next

Review the summary information and click on Finish

Database created successfully..

[oracle@ol7-dev software]$ export ORACLE_SID=db19c
[oracle@ol7-dev software]$ sqlplus

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Nov 10 23:45:18 2020
Version 19.3.0.0.0

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

Enter user-name: /as sysdba

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> select name, open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
DB19C     READ WRITE

Step by step creation of Oracle cloud free tier account and creating a VM

Oracle Cloud free tier account creation

Hello Friends!

This is my first blog post and I hope you will ignore mistakes. Thank you in advance.

Description:

In this blog post I will describe the step by step creation of Oracle cloud always free account and creating a Linux Virtual Machine.

Oracle Cloud Free Tier will allows you to sign up for an Oracle Cloud account which provides a number of Always Free services and a free credit of 300$ which can be use on all eligible Oracle cloud Infrastructure services for up to 30 days. The Always Free services are available for an unlimited period of time. Kindly click here to know more in detail.

We will be covering the following steps:

  1. Create a free Oracle account
  2. Sign into your account
  3. Network Configuration
    • Create Virtual Cloud Network (VCN)
    • Configure Internet Gateway
    • Adding Route table
    • Adding Security list
  4. Creation of Oracle Linux Virtual Machine Instance
  5. Accessing the Linux Virtual Machine Instance

1. Create a free Oracle trial account

Open the web browser to access the Oracle Cloud account registration form

Choose your country and enter your name and email address
Once provided the details, check your email. You will see an account validation email from Oracle.

Enter the account information.
Note: Home Region cannot be changed once you sign-up.

Enter the address information, mobile details & Payment details and verify the same
Note: You need to provide the credit card details and 1$ will be charged for the verification and the same will be reserved. You will not be charged unless you elect to upgrade the account.

2. Sign into your account

Go to cloud.oracle.com and click on Sign into cloud

Enter you cloud account name and click next. This is the name we choose during the account creation

Enter the cloud account credentials and click next. Username is your email address.

You are now login to your cloud account

3. Network Configuration

Create Virtual Cloud Network (VCN)

Open the navigation menu. Under Core Infrastructure, go to Networking and click Virtual Cloud Networks

Select the compartment you want to create the network. Then click on Create VCN

Enter a name for the VCN
For CIDR Block, I choose IP 192.168.10.0/24, so that I can use the private IP range b/w 192.168.10.1 to 192.168.10.254.

Now the VCN status is available

Click on VCN Name (ocvcn) and you will be redirected to VCN Details page. Under Resource select Subnets and then click Create Subnet

Enter the information as per the below screenshot and click on Create Subnet.
Note: Public subnet has selected to access the instance in public n/w.

The subnet is now created

Configure Internet Gateway

From VCN Details page under Resources, click on Internet Gateways

Give it a name and choose the compartment, then click on Create Internet Gateway

Your internet gateway is created. but you still need to add a route rule that allows traffic to flow to the gateway.

Adding Route table

From VNC Details page, Under Resources –> Route Tables, click on the route table associated with your public subnet.

Click on Add Route Rules

This is for the public subnet.
select Target Type as Internet gateway
Destination CIDR Block: 0.0.0.0/0 (This means all the internet)
Once ready, click on Add Route Rules

Now you can see the Internet gateway route has been successfully added

Adding Security lists

Check your public IP using the URL and whitelist it to access the cloud VM which you will be creating in the next steps

From Subnet Details page, Under Resources, select Security Lists and click on the Default Security List as shown below

Click on Add Ingress Rules

Source Type: CIDR
Source CIDR: <Your Public IP>/32
IP Protocol: TCP; Source Port Range: All; Destination Port Range: All
Once ready, Click on Add Ingress Rules

Now you can see your my Public IP is whitelisted

Creation of Oracle Linux Virtual Machine Instance

Open the navigation menu. Under Core Infrastructure, go to Compute and click Instances.

Click on create instance

Name: Enter the name for the instance
Create in Compartment: Select the compartment to create the instance in
Availablilty Zone: Select the Availability domain that you want to create the instance
Image: Select the image, by default Oracle Linux 7.x is used to boot the instance
Shape: Select VM.Standard.E2.1.Micro, which is eligible for always free
Add SSH keys: select Generate SSH Key pair; Click Save Private Key and Save Public key on your computer.

In Management section leave the setting as default

In Networking section enter the private IP and Hostname of the VM. Then click on Create

Wait for the instance creation to complete

After a couple of minutes you can see your Instance is in running state

Accessing the Linux Virtual Machine Instance

Connect the newly created VM from the windows system using ssh.
Before connecting you must set the file permissions for the Private key so that only you can read the file. Do the following.
Reference: https://docs.cloud.oracle.com/en-us/iaas/Content/GSG/Tasks/testingconnection.htm

a. Navigate to <private key file path> which we saved during the VM creation, right-click the file, and then click Properties.

b. On the Security tab, click Advanced.

c. Ensure the owner is yours

d. Click Disable Inheritance, and then select Convert inherited permissions into explicit permissions on this object.

e. Select each permission entry that is not your user account and click Remove.

f. Ensure that the access permission for your user account is Full control and save the changes.

Now we are good to connect to the instance. Open windows command prompt and run the following command.

ssh -i “<private key path>” opc@<public-ip-address>

Thanks for reading my post…

Hope this helps..