SQL LOADER

DESIGNATION:

  • SQL * LOADER loads data from external files into tables of an oracle database.
  • We do not insert the data into the table using SQL * LOADER directly.
  • We need a control file for inserting the data.
  • SQL * LOADER is used to just execute the commands of the control file.
  • The flatfile saving process is normally we will save .txt files.
  • The Control file saving process is normally we will save .ctl files.

BAD FILE:

  • A bad file is used to store the rejected records.
  • The rejected records will store in a bad file automatically.
  • If you wrongly type the data into a flat file, you will surely get some errors. So that error during SQL * LOADER process which stores in bad file.

TYPES OF FLAT FILE:

Variable record flatfile

This is with delimeter

eg., 101, abc, 2000
Fixed record flatfile

This is without delimeter

eg., 101abc2000

The following picture illustrates the SQL * LOADER process:

sql loadet

 

SYNTAX:

$sqlldr <space> userid = username / password

control = ‘path of the controlfile’ <space> log = test.log

Creating a controlfile for variable record flatfile:

BY USING INSERT LOAD DATA PROCESS:

load data

infile ‘path of the flatfile’

insert / append / truncate / replace

into table <table_name>

fields terminated by ‘delimeter_symbol’

optionally enclosed by ‘delimeter_symbol’

trailing nullcols

(col1, col2, col3,……)

OVERALL STEPS:

To execute the SQL * LOADER tool, you need at least three files.

  • The input data files store delimited data
  • The parameter file stores the location of the input and output files.
  • The control file contains the specification on how data is loaded.

Step 1: Create the table at the database level

View the table :

Step 2: Create the text document by using the vi editor in os level

View the text file

Step 3: Create the control file by using the vi editor in the os level

View the control file 

Step 4: Execute the SQL * LOADER syntax

Step 5: View the  table

 

BY USING APPEND LOAD DATA PROCESS:

load data

infile ‘path of the flatfile’

append

into table <table_name>

fields terminated by ‘delimeter_symbol’

optionally enclosed by ‘delimeter_symbol’

trailing nullcols

(col1, col2, col3,……)

Load data in the control file:

View the APPEND output:

BY USING TRUNCATE LOAD DATA PROCESS:

load data

infile ‘path of the flatfile’

truncate

into table <table_name>

fields terminated by ‘delimeter_symbol’

optionally enclosed by ‘delimeter_symbol’

trailing nullcols

(col1, col2, col3,……)

Load data in the control file:

View the TRUNCATE output:

BY USING REPLACE LOAD DATA PROCESS:

load data

infile ‘path of the flatfile’

replace

into table <table_name>

fields terminated by ‘delimeter_symbol’

optionally enclosed by ‘delimeter_symbol’

trailing nullcols

(col1, col2, col3,……)

Load data in the control file:

View the REPLACE output:

 

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter: https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8

Autonomous Health Framework (AHF) – Including TFA and ORAchk/EXAchk (Doc ID 2550798.1)

How to install AHF:

You should install it as root.

To install as root:

  1. Download the appropriate installer from above, copy to a target machine and unzip
  2. Run the TFA & ORAchk/EXAchk install command ./ahf_setup [-ahf_loc install_dir] [-data_dir data_dir]

 

ORAchk/EXAchk compliance check results – To proactively warn you of risks

Trace File Analyzer (TFA) diagnostic collections – Taken automatically on detection of a fault

Once installation is complete TFA will be automatically started.

ORAchk/EXAchk can be started to run automatic compliance checks with the command: orachk -autostart or exachk -autostart

Once autostart has been run ORAchk/EXAchk will perform compliance checks for:

  • The most severe problems at 2am, once a day
  • All known problems once a week at 3am on a Sunday
  • Send an email to the notification addresses, provided during install of any check failures and a diff since the last run

Trace File Analyzer (TFA) will monitor for significant issues.

If any issues are detected TFA will automatically:

  1. Take a diagnostic collection of everything needed to diagnose & resolve (cluster-wide where necessary)
  2. Collocate distributed collections
  3. Analyze collections for known problemsSend an email to the notification addresses, provided during install, containing details of the issues detected, recommended solutions were known, and the location of diagnostic collection(s).

Reference Doc: support.oracle.com

Installation method mentioned below:

[root@oracleagent u01]# ./ahf_setup -data_dir /u01/ahf/output -ahf_loc /u01/ahf

AHF Installer for Platform Linux Architecture x86_64

AHF Installation Log: /tmp/ahf_install_212100_8431_2021_08_30-18_09_41.log

Starting Autonomous Health Framework (AHF) Installation

AHF Version: 21.2.1 Build Date: 202108130422

TFA is already installed at : /u01/app/19.3.0.0/grid/tfa/oracleagent/tfa_home

Installed TFA Version : 181100 Build ID : 20180328025002

AHF Location : /u01/ahf/oracle.ahf

AHF Data Directory : /u01/ahf/output/oracle.ahf/data

Shutting down TFA : /u01/app/19.3.0.0/grid/tfa/oracleagent/tfa_home

Copying TFA Data Files from /u01/app/19.3.0.0/grid/tfa/oracleagent/tfa_home

Uninstalling TFA : /u01/app/19.3.0.0/grid/tfa/oracleagent/tfa_home

Do you want to add AHF Notification Email IDs ? [Y]|N : N

Extracting AHF to /u01/ahf/oracle.ahf

Configuring TFA Services

Copying TFA Data Files to AHF

Discovering Nodes and Oracle Resources

Starting TFA Services

.————————————————————————————————————————.
| Host             | Status of TFA | PID      | Port  | Version     | Build ID                               |
+——————+———————+———-+——–+—————-+————————————-+
| oracleagent | RUNNING      | 12593 | 5000 | 21.2.1.0.0 | 21210020210813042249 |
+——————+———————+———-+——–+—————-+————————————-+

Running TFA Inventory…

Adding default users to TFA Access list…

.———————————————————————————————————–.
| Summary of AHF Configuration                                                                          |
+—————————–+—————————————————————————+
| Parameter                | Value                                                                                  |
+—————————–+—————————————————————————+
| AHF Location          | /u01/ahf/oracle.ahf                                                      |
| TFA Location           | /u01/ahf/oracle.ahf/tfa                                              |
| Orachk Location    | /u01/ahf/oracle.ahf/orachk                                      |
| Data Directory       | /u01/ahf/output/oracle.ahf/data                            |
| Repository              | /u01/ahf/output/oracle.ahf/data/repository       |
| Diag Directory       | /u01/ahf/output/oracle.ahf/data/oracleagent/diag |
‘——————————+—————————————————————————-‘

Starting orachk scheduler from AHF …

Adding rpm Metadata to rpm database on ODA system

RPM File /u01/ahf/oracle.ahf/rpms/oracle-ahf-212100-20210813042249.x86_64.rpm
Preparing… ########################################### [100%]
Using Dummy RPM Installer for oracle-ahf
Tool Install Base /opt/oracle.ahf

1:oracle-ahf ########################################### [100%]
Installing oracle-ahf

AHF binaries are available in /u01/ahf/oracle.ahf/bin

AHF is successfully installed

Do you want AHF to store your My Oracle Support Credentials for Automatic Upload? Y|[N] : N

Moving /tmp/ahf_install_212100_8431_2021_08_30-18_09_41.log to /u01/ahf/output/oracle.ahf/data/oracleagent/diag/ahf/

 

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter: https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8

NID Utility in Oracle

DBNEWID is a database utility, in $ORACLE_HOME/bin directory, that can change the internal database identifier (DBID) and the database name (DBNAME) for an operational database. Prior to the introduction of the DBNEWID utility, we used to manually create a copy of a database and give it a new database name (DBNAME) by re-creating the control file. However, alteration of the internal database identifier (DBID) of an instance was impossible.

The DBID is an internal, unique identifier for a database. Because Recovery Manager(RMAN)  distinguishes databases by DBID, you could not register a seed database and a manually copied database together in the same RMAN repository. The DBNEWID utility solves this problem.

NID utility allows us to change

  • Only DBID of a database
  • Only DBNAME of a database
  • Both DBNAME and DBID of a database

Changing the DBID of a database is a serious procedure. When the DBID of a database is changed all previous backups and archived logs of the database become unusable. After you change the DBID, you must open the database with the RESETLOGS option, which re-creates the online redo logs and resets their sequence to 1. Consequently, you should make a backup of the whole database immediately after changing the DBID.

Changing DBNAME & DBID

SQL> select dbid, name from v$database;

   DBID          NAME
----------    ---------
 247698686    TRAINING

SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL>  STARTUP MOUNT
ORACLE instance started.

Total System Global Area 2432695144 bytes
Fixed Size                  8899432 bytes
Variable Size             536870912 bytes
Database Buffers         1879048192 bytes
Redo Buffers                7876608 bytes
Database mounted.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - 
Production Version 19.3.0.0.0 [oracle@training ~]$ nid TARGET=sqlplus / as sysdba DBNAME=testdb LOGFILE=testdb.log Password:
SQL> select status from v$instance;

STATUS
------------
STARTED

SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-01103: database name 'TESTDB' in control file is not 'TRAINING'

[oracle@training ~]$ cd $ORACLE_HOME/dbs
[oracle@training ~]$ vi inittraining1.ora

training1.__data_transfer_cache_size=0
training1.__db_cache_size=1728053248
training1.__inmemory_ext_roarea=0
training1.__inmemory_ext_rwarea=0
training1.__java_pool_size=0
training1.__large_pool_size=16777216
training1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
training1.__pga_aggregate_target=822083584
training1.__sga_target=2432696320
training1.__shared_io_pool_size=117440512
training1.__shared_pool_size=520093696
training1.__streams_pool_size=0
training1.__unified_pga_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/training1/adump'
*.audit_trail='db'
*.compatible='19.0.0'
*.control_files='/u01/app/oracle/oradata/TRAINING1/control01,dbf','
/u01/app/oracle/oradata/TRAINING1/control02.dbf'
*.db_16k_cache_size=33554432
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_name='testdb'
*.db_recovery_file_dest_size=8256m
*.db_recovery_file_dest='/u01/ARC_BKP'
*.db_unique_name='training1'
*.deferred_segment_creation=FALSE
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=training1XDB)'
*.open_cursors=300
*.pga_aggregate_target=771m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=2312m
*.undo_tablespace='UNDOTBS1'
[oracle@training dbs]$ . oraenv
ORACLE_SID = [training] ?
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@training dbs]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jul 29 02:57:59 2021
Version 19.3.0.0.0

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

Connected to an idle instance.
SQL> startup pfile=$ORACLE_HOME/dbs/inittraining.ora
ORACLE instance started.

Total System Global Area 2432695144 bytes
Fixed Size                  8899432 bytes
Variable Size             536870912 bytes
Database Buffers         1879048192 bytes
Redo Buffers                7876608 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> alter database open resetlogs;

Database altered.
 ‌
SQL> select dbid,name from v$database;
 
      DBID         NAME
----------       ---------
2862448691        TESTDB

SQL> select status,instance_name from v$instance;

STATUS       INSTANCE_NAME
------------ ----------------
OPEN            training


SQL> create spfile from pfile;

File created.

SQL> show parameter spfile;

NAME             TYPE        VALUE
------------- ----------- ------------------------------
spfile         string      /u01/app/oracle/product/19.0.0
                           /dbhome_1/dbs/spfiletraining.ora
                                                 

Change the only DBNAME

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

SQL> startup mount
ORACLE instance started.

Total System Global Area 2432695144 bytes
Fixed Size                  8899432 bytes
Variable Size             536870912 bytes
Database Buffers         1879048192 bytes
Redo Buffers                7876608 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - 
Production Version 19.3.0.0.0 [oracle@training ~]$ nid target=sqlplus / as sysdba dbname=training setname=yes DBNEWID: Release 19.0.0.0.0 - Production on Thu Jul 29 21:48:14 2021 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. Password: Connected to database TESTDB (DBID=2862448691) Connected to server version 19.3.0 Control Files in database: /u01/app/oracle/oradata/TRAINING1/control01.dbf /u01/app/oracle/oradata/TRAINING1/control02.dbf Change database name of database TESTDB to TRAINING? (Y/[N]) => y Proceeding with operation Changing database name from TESTDB to TRAINING Control File /u01/app/oracle/oradata/TRAINING1/control01.dbf -modified Control File/u01/app/oracle/oradata/TRAINING1/control02.dbf - modified Datafile /u01/app/oracle/oradata/TRAINING1/system.dbf - wrote new name Datafile /u01/app/oracle/oradata/TRAINING1/sysaux.dbf - wrote new name Datafile /u01/app/oracle/oradata/TRAINING1/undo.dbf - wrote new name Datafile /u01/app/oracle/oradata/TRAINING1/users.dbf - wrote new name Datafile /u01/app/oracle/oradata/TRAINING1/temp.tmp - wrote new name Instance shut down Database name changed to TRAINING. Modify parameter file and generate a new password file before restarting. Succesfully changed database name. DBNEWID - Completed succesfully.
[oracle@training ~]$ cd $ORACLE_HOME/dbs

[oracle@training dbs]$ vi inittraining1.ora

training1.__data_transfer_cache_size=0
training1.__db_cache_size=1728053248
training1.__inmemory_ext_roarea=0
training1.__inmemory_ext_rwarea=0
training1.__java_pool_size=0
training1.__large_pool_size=16777216
training1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
training1.__pga_aggregate_target=822083584
training1.__sga_target=2432696320
training1.__shared_io_pool_size=117440512
training1.__shared_pool_size=520093696
training1.__streams_pool_size=0
training1.__unified_pga_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/training1/adump'
*.audit_trail='db'
*.compatible='19.0.0'
*.control_files='/u01/app/oracle/oradata/TRAINING1/control01,dbf','
/u01/app/oracle/oradata/TRAINING1/control02.dbf'
*.db_16k_cache_size=33554432
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_name='training'
*.db_recovery_file_dest_size=8256m
*.db_recovery_file_dest='/u01/ARC_BKP'
*.db_unique_name='training1'
*.deferred_segment_creation=FALSE
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=training1XDB)'
*.open_cursors=300
*.pga_aggregate_target=771m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=2312m
*.undo_tablespace='UNDOTBS1'

[oracle@training dbs]$ . oraenv
ORACLE_SID = [training1] ?
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@training dbs]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jul 29 21:52:50 2021
Version 19.3.0.0.0

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

Connected to an idle instance.

SQL> startup pfile='$ORACLE_HOME/dbs/inittraining1.ora'
ORACLE instance started.

Total System Global Area 2432695144 bytes
Fixed Size               8899432 bytes
Variable Size            536870912 bytes
Database Buffers         1879048192 bytes
Redo Buffers             7876608 bytes
Database mounted.
Database opened.

SQL> select name from v$database;

NAME
---------
TRAINING

SQL> select status,instance_name from v$instance;

STATUS       INSTANCE_NAME
--------- ----------------
OPEN         training1

Change only DBID

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

SQL> startup mount
ORACLE instance started.

Total System Global Area 2432695144 bytes
Fixed Size                  8899432 bytes
Variable Size             536870912 bytes
Database Buffers         1879048192 bytes
Redo Buffers                7876608 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - 
Production Version 19.3.0.0.0 [oracle@training dbs]$ nid target=sqlplus / as sysdba DBNEWID: Release 19.0.0.0.0 - Production on Thu Jul 29 22:58:56 2021 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. Password: Connected to database TRAINING (DBID=2862448691) Connected to server version 19.3.0 Control Files in database: /u01/app/oracle/oradata/TRAINING1/control01.dbf /u01/app/oracle/oradata/TRAINING1/control02.dbf Change database ID of database TRAINING? (Y/[N]) => y Proceeding with operation Changing database ID from 2862448691 to 254963316 Control File /u01/app/oracle/oradata/TRAINING1/control01.dbf - modified Control File /u01/app/oracle/oradata/TRAINING1/control02.dbf - modified Datafile /u01/app/oracle/oradata/TRAINING1/system.dbf - dbid changed Datafile /u01/app/oracle/oradata/TRAINING1/sysaux..dbf - dbid changed Datafile /u01/app/oracle/oradata/TRAINING1/undo.dbf - dbid changed Datafile /u01/app/oracle/oradata/TRAINING1/users.dbf - dbid changed Datafile /u01/app/oracle/oradata/TRAINING1/data01.dbf - dbid changed Datafile /u01/app/oracle/oradata/TRAINING1/temp.tmp - dbid changed Control File /u01/app/oracle/oradata/TRAINING1/control01.dbf - dbid changed Control File /u01/app/oracle/oradata/TRAINING1/control02.dbf - dbid changed Instance shut down Database ID for database TRAINING changed to 254963316. All previous backups and archived redo logs for this database are unusable. Database is not aware of previous backups and archived logs in Recovery Area. Database has been shutdown, open database with RESETLOGS option. Succesfully changed database ID. DBNEWID - Completed successfully.
[oracle@training dbs]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jul 29 22:59:46 2021
Version 19.3.0.0.0

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

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 2432695144 bytes
Fixed Size                  8899432 bytes
Variable Size             536870912 bytes
Database Buffers         1879048192 bytes
Redo Buffers                7876608 bytes
Database mounted.

SQL> alter database open resetlogs;

Database altered.

SQL> select name,dbid from v$database;

NAME            DBID
---------   ----------
TRAINING     254963316

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter : https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8

Oracle Statspack Installation / Re-Creation

 

Why we need statspack? However for some non critical database where we don’t have license of tuning pack. Hence we need to survive on statspack.

1) Take export backup of exiting perftstat user

2) Drop statspack

 @?/rdbms/admin/spdrop.sql;

3) Create stastpack

 @?/rdbms/admin/spcreate.sql;

4) Change stastpack snap level to level 6

BEGIN
statspack.modify_statspack_parameter(i_snap_level=>6, i_modify_parameter=>'true');
END;
/
select SNAP_ID, SNAP_LEVEL from STATS$SNAPSHOT;

5) Take manual snap

 exec PERFSTAT.statspack.snap;

6) Schedule statspack auto jobs for statspack snap ( Please note job id)

 @?/rdbms/admin/spauto.sql

7) Change snap interval to 30 min

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

set lines 180
col SCHEMA_USER for a20
col INTERVAL for a30
col WHAT for a30
select JOB, SCHEMA_USER, INTERVAL, BROKEN, WHAT from dba_jobs where JOB=826;
exec dbms_job.interval(826,'sysdate+(1/48)');
alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS';
set lines 180
col SCHEMA_USER for a20
col INTERVAL for a30
col WHAT for a30
select JOB, SCHEMA_USER, INTERVAL, BROKEN, WHAT , 
to_char(next_date ,'DD-MON-YYYY:HH24:MI:SS') "next date" , 
failures from dba_jobs where JOB=826;
select name,snap_id,to_char(snap_time,'DD-MON-YYYY:HH24:MI:SS') "Date/Time" 
from stats$snapshot,v$database;

8) After 30 minutes verify snap interval working fine with 30 min and level 6

@?/rdbms/admin/spreport.sql

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter : https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8

Clearing an Enterprise manager agent that fails to upload

 

This is the standard set of actions that I go through when I have problems with an EM agent that a stop/start/upload does not resolve

The two types of errors I generally see are

EMD upload error: uploadXMLFiles skipped :: OMS version not checked yet..

Starting agent …………………………… started but not ready.

Follow the steps below, which can be cut and pasted

export AGENT_HOME=/app/oracle/agent13c/agent_inst

Stop the agent

$AGENT_HOME/bin/emctl stop agent

Remove the old log files from AGENT_HOME/sysman/log

Delete any pending upload files from the agent home

rm -r $AGENT_HOME/sysman/emd/state/*

rm -r $AGENT_HOME/sysman/emd/upload/*

rm $AGENT_HOME/sysman/emd/lastupld.xml

rm $AGENT_HOME/sysman/emd/agntstmp.txt

rm $AGENT_HOME/sysman/emd/protocol.ini

Start the agent

$AGENT_HOME/bin/emctl start agent

Issue an agent clearstate from the agent home

$AGENT_HOME/bin/emctl clearstate agent

Force an upload to the OMS

$AGENT_HOME/bin/emctl upload agent

Finally I sometimes need to re-secure the agent

$AGENT_HOME/bin/emctl secure agent

 

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter : https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8

Clearing an Enterprise manager agent that fails to upload

 

This is the standard set of actions that I go through when I have problems with an EM agent that a stop/start/upload does not resolve

The two types of errors I generally see are

EMD upload error: uploadXMLFiles skipped :: OMS version not checked yet..

Starting agent …………………………… started but not ready.

Follow the steps below, which can be cut and pasted

export AGENT_HOME=/app/oracle/agent13c/agent_inst

Stop the agent

$AGENT_HOME/bin/emctl stop agent

Remove the old log files from AGENT_HOME/sysman/log

Delete any pending upload files from the agent home

rm -r $AGENT_HOME/sysman/emd/state/*

rm -r $AGENT_HOME/sysman/emd/upload/*

rm $AGENT_HOME/sysman/emd/lastupld.xml

rm $AGENT_HOME/sysman/emd/agntstmp.txt

rm $AGENT_HOME/sysman/emd/protocol.ini

Start the agent

$AGENT_HOME/bin/emctl start agent

Issue an agent clearstate from the agent home

$AGENT_HOME/bin/emctl clearstate agent

Force an upload to the OMS

$AGENT_HOME/bin/emctl upload agent

Finally I sometimes need to re-secure the agent

$AGENT_HOME/bin/emctl secure agent

 

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter : https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8

Restore a TDE Database backup file

 

At Destination Server:

Steps to Restore a TDE Database backup file of Source on Destination Server.

step 1) Create a new Master Key or Alter it using below if it already exists.
CREATE MASTER KEY ENCRYPTION BY PASSWORD=’OracleAgent@DBA$123′; — This can be from Source Server/New one.
–ALTER MASTER KEY ADD ENCRYPTION BY PASSWORD =’OracleAgent@DBA$123′

step 2) Restore the Master DB Certificate of Source Server on Destination Server:
USE master;
GO
CREATE CERTIFICATE TDE_Cert_New
fROM FILE = ‘D:\OracleAgent\TDE\TDE_Cert_New.cer’
WITH PRIVATE KEY(
FILE = ‘D:\OracleAgent\TDE\TDE_Cert_New_PrivateKey.pvk’,
DECRYPTION BY PASSWORD = ‘OracleAgent@DBA$123’
)

step 3) Finally Restore the TDE Enabled DB Backup File on Destination.

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter : https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8

Enable TDE on Source DB

Enable TDE on Source DB

• Create Master Key on MASTER DB
• Backup Master Key of Master DB
• Create Certificate on MASTER DB
• Backup Certificate on MASTER DB
• Create Encryption Key on User DB.
• Finally Enable TDE on User DB

At Source Server:
Step 1: Create Database Master Key on Master DB.
USE master;
GO
CREATE MASTER KEY ENCRYPTION BY PASSWORD=’OracleAgent@DBA$123′;
GO
–Use this if Master key already exists and to add a new Master Key.
–ALTER MASTER KEY ADD ENCRYPTION BY PASSWORD =’OracleAgent@DBA$123′;

Step-2: Backup Master Key of MASTER DB:
USE MASTER
BACKUP MASTER KEY
TO FILE = ‘D:\OracleAgent\TDE\MasterKey.key’
ENCRYPTION BY PASSWORD = ‘OracleAgent@DBA$123’

Step 3: Create a Certificate on Master DB to support TDE
USE master;
GO
CREATE CERTIFICATE TDE_Cert_New
WITH SUBJECT=’Database_Encryption’;
GO

Step-4: Backup Master DB Certificate & Private Key;
This step is not required to encrypt a database using TDE. But to make sure you can recover your encrypted data from a database backup, should your instance database become corrupted, or you want to move an encrypted database to another server, you should backup the certificate.
Run the following code:
USE master;
GO
BACKUP CERTIFICATE TDE_Cert_New
TO FILE = ‘D:\OracleAgent\TDE\TDE_Cert_New.cer’
WITH PRIVATE KEY(
FILE = ‘D:\OracleAgent\TDE\TDE_Cert_New_PrivateKey.pvk’,
ENCRYPTION BY PASSWORD = ‘OracleAgent@DBA$123’
)
Note: Store the PASSWORD in a safe place.

Step 5: Create Database Encryption Key on required User DB.
USE Advworks
GO
CREATE DATABASE ENCRYPTION KEY
WITH ALGORITHM = AES_256
ENCRYPTION BY SERVER CERTIFICATE TDE_Cert_New;

Step 6: Enable TDE on Database
ALTER DATABASE Advworks SET ENCRYPTION ON;

In below document i mentioned how to restore in destination server.

RESTORE TDE IN DESTIANTION SERVER

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter : https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8

When SET DBID needed in RMAN?

Restrictions and Usage Notes for the SET DBID Command:

You should only run the SET DBID command in the following specialized circumstances:

  • You are not connected to a recovery catalog and want to restore the control file or server parameter file.
  • You are connected to a recovery catalog and want to restore the control file, but the database name is not unique in the recovery catalog.

When you restore the control file, you must use the SET DBID command to identify the target database. The DBID is used to determine the location of control file auto backups.

We can get the DBID from below query

Or

when we run the rman to connect the target database:

If you are using RMAN catalog, and you have a clone of your database with the same DBID, how the RMAN will differentiate between them?. Here you need to change the DBID of the cloned database using DBNEWID utility to avoid confusion.

In this below blog i showed you how to change DATABASE Name with DBNEWID utility.

Change DB name with DBNEWID Utility in 19c

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter : https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8

Change PDB name with DBNEWID Utility in 19c


DBNEWID Utility:

NID utility has been introduced with Oracle 10g to change the database name and id. Without NID changing the DBNAME is only possible by recreating the control files. Changing the DBID was not possible before, as this is the database unique identifier. Giving a database a new DBNAME is common after migration of a database instance using Data Guard or duplicate where DBNAME and DB_UNIQUE_NAME differs and shall be synchronized afterwards. In some situation an ORA-01103 error occurs and changing the DBNAME to a new value may be needed.

OVERVIEW:

  1. Verifying the pluggable database
  2. For rename the pluggable database, We need to open the database in Restricted Mode
  3. Set the container database name
  4. Renaming the pluggable database
  5. Open the pluggable database

Note : For an example , I am taking Source PDB “Mumbai” and renaming as “Noida”,  

Step 1:

Verifying the available pluggable database in our local CDB

SQL> select con_id,name,open_mode from v$Pdbs;

Step 2:

Before we need to rename the pluggable database ,We should bring the PDB close and open it in “RESTRICTED MODE”

alter pluggable database mumbai close;

Step 3:

Opening the PDB in restricted mode,

alter pluggable database mumbai open restricted;

Step 4:

Set the PDB “MUMBAI”

alter session set container=mumbai;

Step 5:

Here we are renaming the pluggable database name “mumbai” as “noida”

alter pluggable database rename global_name to noida;

Step 6:

Here we can check the renamed pdb by issuing the below command

select con_id,name,open_mode from v$Pdbs;

But , the database is in restricted mode so we need to open the database,

Now the database name has been changed .