Saturday, 19 September 2020

RMAN Incremental Backup Script

 dt=`date +"%d.%m.%Y"`

rman <<EOF

        spool msglog to '/backup/RMAN/logs/rman_INC_ORAPROD$dt.log'

        connect target /

delete noprompt archivelog all completed before 'sysdate-8';

run {

allocate channel c1 type disk;

BACKUP FORMAT '/backup/RMAN/INC/ORAPRODctrl_%s_%p_%t.rman' CURRENT CONTROLFILE;

RELEASE CHANNEL c1;

allocate channel c1 type disk;

allocate channel c2 type disk;

BACKUP  AS COMPRESSED BACKUPSET  INCREMENTAL LEVEL 1 TAG ORAPROD_BACKUP_LEVEL1 FILESPERSET 4 FORMAT '/backup/RMAN/INC/ORAPROD_%s_%p_%t.rman' DATABASE;

RELEASE CHANNEL c1;

RELEASE CHANNEL c2;

allocate channel c1 type disk;

allocate channel c2 type disk;

BACKUP  as compressed backupset FILESPERSET 5 FORMAT '/backup/RMAN/INC/ORAPROD_ARC_%s_%p_%t.rman' ARCHIVELOG ALL skip inaccessible;

RELEASE CHANNEL c1;

RELEASE CHANNEL c2;

allocate channel c1 type disk;

copy current controlfile to '/backup/RMAN/INC/ORAPRODcontrol.rman';

RELEASE CHANNEL c1;

}

EXIT;

EOF

RMAN Full Backup Script

dt=`date +"%d.%m.%Y"`

rman <<EOF

       spool msglog to '/backup/RMAN/logs/rman_level0_oraprod$dt.log'

        connect target /

        crosscheck archivelog all;

run

{

        allocate channel c1 type disk;

        allocate channel c2 type disk;

BACKUP as compressed backupset INCREMENTAL LEVEL=0 TAG ORAROD_LEVEL0 FILESPERSET 3

FORMAT '/backup/RMAN/FULL/ORAPROD_%s_%p_%t.rman'   DATABASE;

sql 'alter system archive log current';

RELEASE CHANNEL c1;

RELEASE CHANNEL c2;


allocate channel c1 type disk;

BACKUP

FORMAT '/backup/RMAN/FULL/ORAPRODctrl_%s_%p_%t.rman'

CURRENT CONTROLFILE;

RELEASE CHANNEL c1;

allocate channel c1 type disk;

allocate channel c2 type disk;

BACKUP  as compressed backupset FILESPERSET 5

FORMAT '/backup/RMAN/FULL/ORAPROD_ARC_%s_%p_%t.rman'

ARCHIVELOG ALL skip inaccessible;

RELEASE CHANNEL c1;

RELEASE CHANNEL c2;

allocate channel c1 type disk;

copy current controlfile to '/backup/RMAN/FULL/ORAPRODcontrol.rman';

RELEASE CHANNEL c1;

}

EXIT;

EOF



RC-50013: Fatal: Instantiate driver did not complete successfully

Running  perl adcfgclone.pl  dbTier  on target , got below error

AutoConfig could not successfully execute the following scripts:

Directory: /database/oracle/db/tech_st/11.2.0/perl/bin/perl -I /database/oracle/db/tech_st/11.2.0/perl/lib/5.8.3 -I /database/oracle/db/tech_st/11.2.0/perl/lib/site_perl/5.8.3 -I /database/oracle/db/tech_st/11.2.0/appsutil/perl /database/oracle/db/tech_st/11.2.0/appsutil/clone

ouicli.pl   INSTE8_APPLY 255


Solution:  Backup the previous /etc/oraInventory and created the new one

     # mv oraInventory  oraInventory_old

     # mkdir -p oraInventory

     $ perl adcfgclone.pl dbTier


     Database clone completed successfully



Sunday, 13 September 2020

Assign IDCS Group to IDCS User

Assign the IDCS User created in my previous blog to IDCS_DevelopmentGrouo to grant full access in DevelopmnetCompartment


OCI

     -Identity

            -Federation

                    -Identity Provider Details (OracleIdentityCloudService)

                            -Users

                                    -User Details


    Click on Add to IDCS Group


 

MAP IDCS Group and OCI Group

Map the IDCS Group and OCI Group to provide  the permissions  granted to the OCI group

OCI -  
        -Identity 
                      - Federation 

                                        -Identity Provider Details (OracleIdentityCloudService)                                                     - Group Mappings



Click on Add Mappings


Select  IDCS_DevelopmentGroup  from drop down for IDENTITY PROVIDER GROUP and DevelopmentGroup for OCI GROUP

Click on Add Mappings

 The mapping displayed as



Create IDCS Group in OCI

 OCI - Identity - Federation - Identity Provider Details (OracleIdentityCloudService)


Click on Create IDCS Group

In my case Name is IDCS_DevelopmentGroup and Description "IDCS Group for Development Group" 




 Click on Create

 Now Group will be created with below information





Create Policy in OCI

Policy is required to give Group permission in the Compartment

In my case  Group =DevelopmentGroup

        Compartment=DevelopmentCompartment 

Both Group and Compartment were created in my previous blog. For details, how to create Group and Compartment refer my previous blog.

OCI - Identity - Policies

Click on Create Policy  


Provide the Policy Name , in my case it is PolicyDevelopment  and Description "Policy to give DevelopmentGroup permission in DevelopmentCompartment"

Enter the Statement in Policy Builder. It will provide access based on this statement.

The statement  "Allow group DevelopmentGroup to manage all-resources in compartment DevelopmentCompartment"    Grants  full permissions on the Development compartment



 Click on Create 


Create Group in OCI

 Identity - Groups


Click on Create Group

Provide Name,in my case it is DevelopmentGroup along with  description


Click on Group  to create it.

Create Compartments in OCI

Identity  -  Compartments


Provide Name , in my case , provided "Development" along with a valid description to tell the usage of the compartment

In PARENT COMPARTMENT,  select the root compartment  or the name of  child compartment, where you want to create it

Click on "Create Compartment"



Assign Cloud Account Administrator Role

Once you created the user  using Identity - Federation - Create user.  You need to assign the roles to access the OCI resources . Follow the below steps to assign the "Cloud Account Administrator Role".

In the Create user section, we can see the created user. Click on the user, it will open the another window, where you can assign the roles. 

Click on Manage Roles


Select the check box to assign Cloud Account Administrator Role and click on Apply Role Setting



Create a Cloud Administrator user in OCI

1. Login to Oracle Cloud

2. Select Identity - Federation

     

3. Click on OracleIdentityCloudService



4. 


5. Create user

  Provide all the relevant information to create it


After creating the user, follow the Email Instruction / Copy Instruction to rest the password to sign in to the Oracle Cloud Console






Sunday, 30 August 2020

Oracle - Dataguard Switchover

On Production

SQL> alter system switch logfile

SQL> select  database_role,switchover_status from v$database

Verify the output  , database_role= PRIMARY

                     switchover_status= TO STANDBY

Run the below command to switch PRIMARY database to STANDBY

SQL> alter database commit to switchover to physical standby  with session shutdown

SQL> shutdown immediate

SQL> startup nomount

SQL> alter database mount standby database

SQL> alter system set log_archive_dest_stat_2=DEFER

Note: This Production will become the new Standby

On Standby

SQL>  select  database_role,switchover_status from v$database

SQL> alter database commit to switchover to primary with session shutdown

SQL> shutdown immediate

SQL> startup

Note: This Standby will become the new Production 

On new STANDBY [old Production]

SQL> alter database recover managed standby database using current logfile disconnect

Saturday, 29 August 2020

Start the Oracle Standby Database

On Standby Server

SQL >  startup nomount

SQL > alter database mount standby database

SQL>  alter database recover managed standby database disconnect from session

_______________________________________________________________________

On Production Server

SQL>  alter system set log_archive_dest_2 = ENABLE

_______________________________________________________________________

Shutdown the Oracle Standby Database

On Production Database Server

Run the below command to defer the archive log destination parameter set for Standby Database

SQL> alter system set log_archive_dest_stat_2=DEFER;

__________________________________________________________________

On Standby Database Server

SQL> select process,status from v$managed_standby


Cancel Managed Recovery

SQL> alter database recover managed standby database cancel

 Shutdown the standby Database

SQL > shutdown immediate

__________________________________________________________________



Saturday, 11 July 2020

Create PostgreSQL Database

1.Login to pgAdmin 4

2. Right Click on Database . Select Create - Database



3. In the General TAB 
       . Provide the Database Name 
       . Enter the appropriate comment 


4. Definition Tab
     Verify Encoding 
     Template
     Tablespace




5. To view Create Database Script , click on SQL tab


Click on Save to Create the Database

6. MyFirstDB is Created and you can view the Database in pgAdmin 4