Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all 1640 articles
Browse latest View live

Script to delete RMAN backupsets older than a specified number of days

$
0
0
DAYSTOKEEP=60

# -- Do not change anything below this line ---------------------------

CMDFILE=/tmp/rmanpurge$$.rcv
LOGFILE=/tmp/rmanprige$$.log

if [ ! -x $ORACLE_HOME/bin/rman ]; then
echo "ERROR: RMAN not found or ORACLE_HOME not set."
exit 8
fi
if [ ! $ORACLE_SID ]; then
echo "ERROR: ORACLE_SID not set."
exit 8
fi
if [ ! $1 ]; then
echo "USAGE: $0 CatalogConnectString"
exit;
else
RCVCAT=$1
fi;

echo "Delete RMAN backupsets older than $DAYSTOKEEP days for db $ORACLE_SID."
echo "ALLOCATE CHANNEL FOR DELETE TYPE 'SBT_TAPE';">>$CMDFILE

# List all old entries that needs to be deleted
(rman rcvcat $RCVCAT target / <<-EOF
list backupset of database
from time 'SYSDATE-3000' until time 'SYSDATE-$DAYSTOKEEP';
exit;
EOF
) | grep RMAN-06233 | while read filler key filler filler date rest
do
echo "# Delete backupset $key dated $date...">>$CMDFILE
echo "CHANGE BACKUPSET $key DELETE;">>$CMDFILE
done

echo "RELEASE CHANNEL;">>$CMDFILE

# Delete the old entries
rman rcvcat $RCVCAT target / cmdfile $CMDFILE

echo "Done!"

Script to know the audit information

$
0
0
conn / as sysdba

tti "Auditing Initialisation Parameters:"
select name || '=' || value PARAMETER
from sys.v_$parameter where name like '%audit%'
/

tti "Statement Audits Enabled on this Database"
column user_name format a10
column audit_option format a40
select *
from sys.dba_stmt_audit_opts
/

tti "Privilege Audits Enabled on this Database"
select * from dba_priv_audit_opts
/

tti "Object Audits Enabled on this Database"
select (owner ||'.'|| object_name) object_name,
alt, aud, com, del, gra, ind, ins, loc, ren, sel, upd, ref, exe
from dba_obj_audit_opts
where alt != '-/-' or aud != '-/-'
or com != '-/-' or del != '-/-'
or gra != '-/-' or ind != '-/-'
or ins != '-/-' or loc != '-/-'
or ren != '-/-' or sel != '-/-'
or upd != '-/-' or ref != '-/-'
or exe != '-/-'
/

tti "Default Audits Enabled on this Database"
select * from all_def_audit_opts
/

Script to analyze all table and index partitions individually

$
0
0
set feed off echo off head off trimspool on line 500

spool /tmp/analyze$$.sql

select 'ANALYZE TABLE '||table_owner||'.'||table_name||' partition ('||
partition_name||') estimate statistics;'
from sys.dba_tab_partitions
/

select 'ANALYZE INDEX '||index_owner||'.'||index_name||' partition ('||
partition_name||') estimate statistics;'
from sys.dba_ind_partitions
/

spool off

set feed on
@/tmp/analyze$$.sql
! rm /tmp/analyze$$.sql

Script to determine the high water mark of tables

$
0
0
set verify off
column owner format a10
column alcblks heading 'Allocated|Blocks' just c
column usdblks heading 'Used|Blocks' just c
column hgwtr heading 'High|Water' just c
break on owner skip page

select
a.owner,
a.table_name,
b.blocks alcblks,
a.blocks usdblks,
(b.blocks-a.empty_blocks-1) hgwtr
from
dba_tables a,
dba_segments b
where
a.table_name=b.segment_name
and a.owner=b.owner
and a.owner not in('SYS','SYSTEM')
and a.blocks <> (b.blocks-a.empty_blocks-1)
and a.owner like upper('&owner')||'%'
and a.table_name like upper('&table_name')||'%'
order by 1,2
/

set verify on
clear columns
clear breaks

Script to get the details of Index fragmentation of a schema

$
0
0
prompt -- Drop and create temporary table to hold stats...
drop table my_index_stats
/
create table my_index_stats (
index_name varchar2(30),
height number(8),
del_lf_rows number(8),
distinct_keys number(8),
rows_per_key number(10,2),
blks_gets_per_access number(10,2)
)
/

prompt -- Save script which we will later use to populate the above table...
insert into my_index_stats
select NAME, HEIGHT, DEL_LF_ROWS, DISTINCT_KEYS, ROWS_PER_KEY,
BLKS_GETS_PER_ACCESS
from INDEX_STATS
-- Note this open line...

save /tmp/save_index_stats.sql replace

prompt
prompt -- Spool listing with validate commands...
col line1 newline
col line2 newline
col line3 newline
set pagesize 0
set echo off
set termout off
set trimspool on
set feed off
set linesize 200
spool /tmp/validate_indexes.sql
select 'prompt Process table '||owner||'.'||table_name||
', index '||index_name||'...' line1,
'validate index '||owner||'.'||index_name||';' line2,
'@/tmp/save_index_stats.sql' line3
from sys.dba_indexes where owner = 'SCOTT'
order by table_name, index_name
/
spool off
set termout on
set feed on

prompt
prompt -- Run script to validate indexes...
@/tmp/validate_indexes.sql

prompt -- Print nice report...
set pagesize 50000
set trimspool on
col height format 99999
col del_rows format 9999999
col rows/key format 999999.9
spool idxfrag.lst
select INDEX_NAME, HEIGHT, DEL_LF_ROWS "DEL_ROWS", DISTINCT_KEYS "DIST KEYS",
ROWS_PER_KEY "ROWS/KEY",
BLKS_GETS_PER_ACCESS "BLKS/ACCESS"
from MY_INDEX_STATS
/
spool off

-- Cleanup
drop table my_index_stats
/
! rm /tmp/validate_indexes.sql
! rm /tmp/save_index_stats.sql

prompt
prompt Report is in idxfrag.lst
prompt Done!!!

Script to copy table from one database to another database

$
0
0
-- STEPS:
--
-- Disable constraints
-- Disable triggers
-- Copy
-- Enable constraints
-- Enable triggers

SET SERVEROUTPUT ON
PROMPT Enter the table's name you want to copy
DEFINE tname = &table_name
PROMPT
PROMPT Enter the FROM database id
DEFINE dbname = &database_id
PROMPT
PROMPT Enter the FROM user id
DEFINE uname = &user_id

SPOOL TAB_COPY.SQL
DECLARE
v_table_name VARCHAR2( 30) := '&&tname';
v_user_name VARCHAR2( 30) := '&&uname';
v_db_name VARCHAR2( 30) := '&&dbname';

BEGIN
dbms_output.enable( 100000);
v_table_name := UPPER( v_table_name);
v_user_name := UPPER( v_user_name);
v_db_name := UPPER( v_db_name);

-- Disable the constraints from other tables
FOR c1 IN (SELECT con.constraint_name,
con.status
FROM user_constraints con
WHERE con.table_name = v_table_name
AND con.constraint_type = 'R'
)
LOOP
IF c1.status = 'ENABLED' THEN
dbms_output.put_line
( 'PROMPT Disable constraint '|| c1.constraint_name||
' on table '|| v_table_name
);
dbms_output.put_line
( 'ALTER TABLE '|| v_table_name|| ' DISABLE CONSTRAINT '||
c1.constraint_name
);
dbms_output.put_line( '/');
ELSE
dbms_output.put_line
( 'PROMPT Constraint '|| c1.constraint_name||
' on table '|| v_table_name||
' is already DISABLED.'
);
dbms_output.put_line
( 'REM ALTER TABLE '|| v_table_name|| ' DISABLE CONSTRAINT '||
c1.constraint_name
);

END IF;
END LOOP;

-- Disable the constraints to the table on other tables
FOR c1 IN (SELECT con.table_name,
con.constraint_name,
con.status
FROM user_constraints con
WHERE con.r_constraint_name IN
(SELECT con1.constraint_name
FROM user_constraints con1
WHERE con1.table_name = v_table_name
AND con1.constraint_type IN ('P', 'U'))
AND con.constraint_type = 'R'
)
LOOP
IF c1.status = 'ENABLED' THEN
dbms_output.put_line
( 'PROMPT Disable constraint '|| c1.constraint_name||
' on table '|| c1.table_name
);
dbms_output.put_line
( 'ALTER TABLE '|| c1.table_name|| ' DISABLE CONSTRAINT '||
c1.constraint_name
);
dbms_output.put_line( '/');
ELSE
dbms_output.put_line
( 'PROMPT Constraint '|| c1.constraint_name||
' on table '|| c1.table_name||
' is already DISABLED.'
);
dbms_output.put_line
( 'REM ALTER TABLE '|| c1.table_name|| ' DISABLE CONSTRAINT '||
c1.constraint_name
);

END IF;
END LOOP;

-- Disable the triggers on the table
FOR c1 IN (SELECT trg.trigger_name,
trg.status
FROM user_triggers trg
WHERE trg.table_name = v_table_name
)
LOOP
IF c1.status = 'ENABLED' THEN
dbms_output.put_line
( 'PROMPT Disable trigger '|| c1.trigger_name||
' on table '|| v_table_name
);
dbms_output.put_line
( 'ALTER TRIGGER '|| c1.trigger_name|| ' DISABLE'
);
dbms_output.put_line( '/');
ELSE
dbms_output.put_line( 'PROMPT Trigger '|| c1.trigger_name||
' on table '|| v_table_name||
' is already DISABLED.');
END IF;
END LOOP;

dbms_output.put_line( 'PROMPT Truncate table '|| v_table_name);
dbms_output.put_line( 'TRUNCATE TABLE '|| v_table_name);
dbms_output.put_line( '/');

-- dbms_output.put_line( 'PROMPT Delete the table');
-- dbms_output.put_line( 'DELETE '|| v_table_name);
-- dbms_output.put_line( '/');

dbms_output.put_line( 'PROMPT Copy the table from '|| v_db_name);
dbms_output.put_line( 'COPY FROM '|| v_user_name|| '@'|| v_db_name|| ' -');
dbms_output.put_line( 'INSERT '|| v_table_name ||' USING -');
dbms_output.put_line( 'SELECT * FROM '|| v_table_name);

-- dbms_output.put_line( 'SELECT '|| v_table_name);
-- FOR c1 IN (SELECT utcol.column_name
-- FROM user_tab_columns utcol
-- WHERE utcoltable_name = v_table_name)
-- LOOP
-- dbms_output.put_line( utcol.column_name|| ', -');
-- END LOOP
-- dbms_output.put_line( 'FROM '|| v_table_name);

--
-- Enable the constraints from other tables
FOR c1 IN (SELECT con.constraint_name,
con.status,
con2.table_name
FROM all_constraints con,
all_constraints con2
WHERE con.table_name = v_table_name
AND con.constraint_type = 'R'
AND con.r_constraint_name = con2.constraint_name
)
LOOP
dbms_output.put_line
( 'PROMPT Enable constraint '|| c1.constraint_name||
' to table '|| c1.table_name
);
dbms_output.put_line
( 'PROMPT on table '|| v_table_name
);

dbms_output.put_line
( 'ALTER TABLE '|| v_table_name|| ' ENABLE CONSTRAINT '||
c1.constraint_name
);
dbms_output.put_line( '/');
END LOOP;

-- Enable the constraints to the table on other tables
FOR c1 IN (SELECT con.table_name,
con.constraint_name,
con.status
FROM user_constraints con
WHERE con.r_constraint_name IN
(SELECT con1.constraint_name
FROM user_constraints con1
WHERE con1.table_name = v_table_name
AND con1.constraint_type IN ('P', 'U'))
AND con.constraint_type = 'R'
)
LOOP
dbms_output.put_line
( 'PROMPT Enable constraint '|| c1.constraint_name||
' on table '|| c1.table_name
);

dbms_output.put_line
( 'ALTER TABLE '|| c1.table_name|| ' ENABLE CONSTRAINT '||
c1.constraint_name
);
dbms_output.put_line( '/');
END LOOP;

-- Enable the triggers on the table
FOR c1 IN (SELECT trg.trigger_name,
trg.status
FROM user_triggers trg
WHERE trg.table_name = v_table_name
)
LOOP
dbms_output.put_line
( 'PROMPT Enable trigger '|| c1.trigger_name||
' on table '|| v_table_name
);
dbms_output.put_line
( 'ALTER TRIGGER '|| c1.trigger_name|| ' ENABLE'
);
dbms_output.put_line( '/');
END LOOP;

END;
/
SPOOL OFF

Script to get explain plan for the baselines created with SQL_ID

$
0
0
Please run the below query and get the explain plan for which baselines created for an SQL ID.

col sql_text for a60 wrap
set verify off
set pagesize 999
set lines 155
col username format a13
col prog format a22
col sid format 999
col child_number format 99999 heading CHILD
col ocategory format a10
col avg_etime format 9,999,999.99
col avg_pio format 9,999,999.99
col avg_lio format 999,999,999
col etime format 9,999,999.99
SELECT sql_handle
FROM
  (SELECT t.SQL_HANDLE,
    t.SIGNATURE,
    t.SQL_TEXT,
    s.SQL_ID
  FROM SYS.SQL$TEXT t,
    DBA_HIST_SQLSTAT s
  WHERE s.SQL_ID = nvl('&sql_id',sql_id)
  AND t.SIGNATURE    = s.FORCE_MATCHING_SIGNATURE
  ) WHERE rownum = 1 ;

spool baseline.out
select * from table(dbms_xplan.display_sql_plan_baseline('&sql_handle',format => 'all'));
spool off
quit

Steps to upgrade Time Zone version to 26 for 12.2 database.

$
0
0
Please follow the below steps to update the timezone to 26 for 12.2 database.

conn / as sysdba
purge dba_recyclebin;

EXEC DBMS_APPLICATION_INFO.SET_CLIENT_INFO('upg_tzv') ;
alter session set "_with_subquery"=materialize;
alter session set "_simple_view_merging"=TRUE;

exec DBMS_DST.BEGIN_PREPARE(26);

SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value  FROM DATABASE_PROPERTIES WHERE PROPERTY_NAME LIKE 'DST_%' ORDER BY PROPERTY_NAME;

TRUNCATE TABLE SYS.DST$TRIGGER_TABLE;
TRUNCATE TABLE sys.dst$affected_tables;
TRUNCATE TABLE sys.dst$error_table;

set serveroutput on
BEGIN
DBMS_DST.FIND_AFFECTED_TABLES (affected_tables => 'sys.dst$affected_tables', log_errors => TRUE, log_errors_table => 'sys.dst$error_table');
END;
/

SELECT * FROM sys.dst$affected_tables;
SELECT * FROM sys.dst$error_table;
EXEC DBMS_DST.END_PREPARE;

SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value FROM DATABASE_PROPERTIES WHERE PROPERTY_NAME LIKE 'DST_%' ORDER BY PROPERTY_NAME;

conn / as sysdba
shutdown immediate;
startup upgrade;
set serveroutput on

SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value FROM DATABASE_PROPERTIES WHERE PROPERTY_NAME LIKE 'DST_%' ORDER BY PROPERTY_NAME;

purge dba_recyclebin;

TRUNCATE TABLE SYS.DST$TRIGGER_TABLE;
TRUNCATE TABLE sys.dst$affected_tables;
TRUNCATE TABLE sys.dst$error_table;

EXEC DBMS_APPLICATION_INFO.SET_CLIENT_INFO('upg_tzv')

alter session set "_with_subquery"=materialize;
alter session set "_simple_view_merging"=TRUE;

EXEC DBMS_DST.BEGIN_UPGRADE(26);

SELECT * FROM sys.dst$error_table;

SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value  FROM DATABASE_PROPERTIES WHERE PROPERTY_NAME LIKE 'DST_%'  ORDER BY PROPERTY_NAME;

SELECT OWNER, TABLE_NAME, UPGRADE_IN_PROGRESS FROM ALL_TSTZ_TABLES where UPGRADE_IN_PROGRESS='YES';

shutdown immediate
startup

alter session set "_with_subquery"=materialize;
alter session set "_simple_view_merging"=TRUE;

set serveroutput on
VAR numfail number
BEGIN
DBMS_DST.UPGRADE_DATABASE(:numfail, parallel => TRUE, log_errors => TRUE, log_errors_table => 'SYS.DST$ERROR_TABLE', log_triggers_table => 'SYS.DST$TRIGGER_TABLE', error_on_overlap_time => FALSE, error_on_nonexisting_time => FALSE);
DBMS_OUTPUT.PUT_LINE('Failures:'|| :numfail);
END;
/

SELECT * FROM sys.dst$error_table;

VAR fail number
BEGIN
DBMS_DST.END_UPGRADE(:fail);
DBMS_OUTPUT.PUT_LINE('Failures:'|| :fail);
END;
/

SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value FROM DATABASE_PROPERTIES WHERE PROPERTY_NAME LIKE 'DST_%' ORDER BY PROPERTY_NAME;

SELECT * FROM v$timezone_file;

connect / as sysdba
SELECT VERSION FROM v$timezone_file;
select TZ_VERSION from registry$database;

conn / as sysdba
update registry$database set TZ_VERSION = (select version FROM v$timezone_file);
commit;


Steps to clone a database through RMAN using standby database.

$
0
0
Please follow the below for database clone through RMAN using standby database.



1)  Step 1:
-------------------

a) Cancel the recovery in CTL DR on dbprod01.
b) Open the database in read only mode. - alter database open read only;
c) start the below listener on CTL DR. - LISTENER_DD_RESTORE (Create one for this)




2) Step 2  :
--------------

a) connect BTLP database and do the below (This database has to be recreated again)


shutdown immediate;
startup nomount;
alter database mount exclusive;
alter system enable restricted session;
drop database;



b) startup nomount pfile='/orahome/app/oracle/product/11204/BTLP/dbs/initBTL.ora' ( Please check db_file_name_convert and log_file_name_convert are perfectly edited)

c) Create and Start the listener - LISTENER_BTLP_CLONE


d)

rman target sys/pwd@CTL_DD_RESTORE auxiliary sys/pwd@BTLP_CLONE 

run 
{
ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
ALLOCATE CHANNEL c2 DEVICE TYPE DISK;
ALLOCATE CHANNEL c3 DEVICE TYPE DISK;
ALLOCATE CHANNEL c4 DEVICE TYPE DISK;
ALLOCATE CHANNEL c5 DEVICE TYPE DISK;
ALLOCATE CHANNEL c6 DEVICE TYPE DISK;
ALLOCATE CHANNEL c7 DEVICE TYPE DISK;
allocate auxiliary channel c8 device type disk ;  
allocate auxiliary channel c9 device type disk ; 
allocate auxiliary channel c10 device type disk ; 
duplicate target database to BTLP from active database nofilenamecheck;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
release channel c7;
release channel c8;
release channel c9;
release channel c10;
}




e) shut down the db and open it

f) create spfile.
shut the database and open it in spfile.

g)
shutdown immediate;
startup mount;
alter database noarchivelog;
alter database open;

h) stop the listener - LISTENER_BTLP_CLONE




Step 3
_______


a) Shut down the DR
b) startup mount
c) ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION; 

d) stop the listener - LISTENER_DD_RESTORE

Thats it.

Article 2

$
0
0
List of hidden parameters in Oracle database:-

SET PAUSE ON
SET PAUSE 'Press Return to Continue'
SET PAGESIZE 60
SET LINESIZE 300

COLUMN ksppinm FORMAT A50
COLUMN ksppstvl FORMAT A50

SELECT
ksppinm,
ksppstvl
FROM
x$ksppi a,
x$ksppsv b
WHERE
a.indx=b.indx
AND
substr(ksppinm,1,1) = '_'
ORDER BY ksppinm
/

Terraform : Creating New EC2 instance via Terraform

$
0
0

In this post, We will share - What is Terraform, How to install it, and How to Create EC2 instance via Terraform.

What is Terraform

Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.

The infrastructure Terraform can manage includes low-level components such as compute instances, storage, and networking, as well as high-level components such as DNS entries, SaaS features, etc.

Terraform supports Multiple Cloud providers, Oracle , AWS, Microsoft..List goes on https://www.terraform.io/docs/providers/index.html

terraform works based on or using configuration files with extension .tf 

How to Install

its Pretty Simple , 
1. Download the zip file which contains the executable based on your platform from https://www.terraform.io/

2. Extract the zip file

3. Set the Path Environment Variable mapping to location where you extracted the zip file

4. open bash prompt or command prompt, and check , terraform --version

C:\Users\dummy> terraform --version
Terraform v0.11.13

How to create configuration file

The set of files used to describe infrastructure in Terraform is simply known as a Terraform configuration. We're going to write our first configuration now to launch a single AWS EC2 instance.
The format of the configuration files is documented here. Configuration files can also be JSON, but we recommend only using JSON when the configuration is generated by a machine.
The entire configuration is shown below. We'll go over each part after. Save the contents to a file named am1.tf. Verify that there are no other *.tf files in your directory, since Terraform loads all of them.
open notepad or vi , am1.tf , copy the below highlight contents and make required changes , and save it.
Below case we are using provider as aws , ie amazon web services.
Resource - Type of resource , we are planning to provision or manage
provider "aws" {
  access_key = "vandendapaalkaren"
  secret_key = "adaddaaapasumattapathipadaporen"
  region     = "us-east-2"
}

resource "aws_instance""example" {
  ami           = "ami-0cd3dfa4e37921605"
  instance_type = "t2.micro"

}




Note: The above configuration is designed to work on most EC2 accounts, with access to a default VPC. For EC2 Classic users, please use t1.micro for instance_type, and ami-408c7f28 for the ami. If you use a region other than us-east-1 then you will need to choose an AMI in that region as AMI IDs are region specific.

As mentioned above , Replace the ACCESS_KEY_HERE and SECRET_KEY_HERE with your AWS access key and secret key, available from this page.


How to configure a resource in Cloud?

Once the configuration file is created, There are two step process

go to the location where created the *.tf file, Ensure there is no other tf created over there

Step 1 : init - Execute "terraform init" from the command prompt,

init will download the plugin required ,and initializes various local settings and data that will be used by subsequent commands

c:\terraform>terraform init







Step 1.2  : Plan - if in case there are any changes to the configuration after init, then you need to Execute "terraform plan" from the command prompt,

In the same directory as the am1.tf file you created, run terraform plan







Step 2 : apply - Once all set with configuration, then we need to apply the configuration. Execute "terraform apply" from the command prompt,


 





Check now in your AWS Console....Congratulations.






Article 0

$
0
0

SYSTEM Tablespace is space increasing Abnormally in 12c


SYSTEM tablespace was growing rapidly. We observe that we were not doing much on this database. Only few users were working to test the application
There was no much load as well, still it's went up to 100gb. 

Database version is 12cR1

Possibly there are few reasons for the same.

1)    Some has assigned default tablespace as SYSTEM
2)    Auditing is ON and consuming more space.
3)    SYS_LOB Objects uses lot of disk space
4)    Data dictionary objects uses lot of disk space

How to find the root cause and what could be the solution?

Let’s query to dba_segments table to find the root cause. Here we have few scenarios in different databases, discussing those scenarios, what could be the problem and solution of it.

Use below query to find out what are those segments which are consuming lot of space in SYSTEM tablespace.

select owner,segment_name,segment_type
 ,bytes/(1024*1024) size_mb
 from dba_segments
 where tablespace_name = 'SYSTEM'
 order by size_mb desc

Scenario 1


Here in above database my AUD$ table is growing rapidly and it is almost 30gb in size.

Problem
Auditing is enabled hence AUD$ table is growing very fast. Organization wants to do auditing and there is no option to disable it.

Solution
Few solutions which Oracle always recommended,
 ‘-  Move AUD$ to different tablespace 
‘- Purge audit data
‘- Delete/truncate older data

Scenario 2

ARGUMENT$, I_ARGUMENT1, I_ARGUMENT2, IDL_UB1$, SOURCE$ ; tables and indexes showing very huge in size. 
These tables are core dictionary tables. Consider like these tables stores your database/schema/table procedure’s meta data information.

You cannot move those tables to another table space or truncate or reorg of these table. Oracle strictly says that don’t touch those tables as these are metadata tables. If you move or truncate tables, you might lose database information and this will corrupts your database as well.

So, is this the ideal scenario? 
Can’t we control the growth of those tables like AUD$ tables?

Answer is, Yes, this is the ideal scenario and we don’t have control over it.

Scenario 3
SYSTEM tablespace growing unexpectedly after database upgrade OR after IMPDP

If you are upgrading your database from 11g to 12c, this might happen that you observer some unexpected growth of SYSTEM tablespace.

Here I would like to highlight that when you do the data import; import do lots of compilation of your function, procedure and packages. Metadata is associated with PL/SQL library. During compilation it generates duplicate rows in ARGUMENT$ table, which cause to huge size of ARGUMENT$ table.

This behavior found in 12c database due to new features introduced and reported as BUG. Here is the bug information.
Bug 5910872 : ARGUMENT$ DATA UNNECESSARILY DUPLICATED. 

Solution
Here the workaround is to recompile the objects. This will decrease the logical space, not the physical space.
Run this command after impdp,
Example
1) alter session set events ='10946 trace name context forever, level 8454144'; 

2) exec utl_recomp.recomp_parallel('4','<USERNAME>');   

Scenario 4


Data dictionary tables are occupying more space like BOOTSTRAP$, FILE$, UNDO$, IDL_UB1$, SOURCE$ etc.
Such issue found in Oracle Database 9i, 10g, 11g. Still I haven’t faced this type of issue in 12c or 18c.


Solution
To resolve this issue run catalog.sql and catproc.sql and re-query to dba_segments. This will work only in certain scenarios only, this is not for all.

Article 0

$
0
0

   18c Oracle Database Installation(On-Premise)

You have three options to install database; Starting with Oracle Database 18c release.
1) Image-based Oracle Database Installation
2) RPM-Based Oracle Database Installation
3) Read-Only Oracle Home

1) Image-based Oracle Database Installation (new in Oracle 18c, on-premise)
Image-based Installation enables you to download zip file and extract the image software into your Oracle Home directory and run Installer script to start database installation.
Unzip the download and Re-link binaries...that's it.

2) RPM-Based Oracle Database Installation
Here, using RPM-based Database Installation (RDI), use rpm -ivh command to install database installation, which performs pre-validations, extract packages assigns ownership, oracle inventory, users and groups, and executes all other scripts and root operations to complete database software installation.

3) Read-Only Oracle Home (new in Oracle 18c, on-premise)
In this option, you are privileged to make your Oracle Home in read-only mode. Database tools and processes writes under ORACLE_BASE path rather ORACLE_HOME directory.
This helps to do version control and patching oracle home. Oracle has include built-in tool, called "rhpctl", that enables you to switch from the current Oracle Database home to a patched Oracle Database home.

I am using Image-based Oracle Database Installation

Download Oracle Dabase 18c from this link.
https://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

Unzip the installer.
$ unzip -d LINUX.X64_180000_db_home.zip /u01/DB18c

















Database binaries are installed. 

Now you can use dbca to configure database.
Create and configure single instance database.

























How to Create Oracle Cloud Promotion Account

$
0
0

This post is to create Promotion (trial) account for Oracle public Cloud. 

1. Open below link in Web Browser. Enter Valid Email Address



2. Click on Next Button. Which implicitly mean you are agreeing to the terms ( if you are using it for Commercial purpose, suggested to review it once). 

3. if you are going to use Oracle Cloud for Databases at work place, Select Business. if in case you are going to use Oracle cloud for educating yourself then select personal.

4. Cloud account name should be unique, to make it easy use your email id.

5. This post is as of April 2019, Default Data Region shows me for EMEA and North America. Select based on your region, near to you or preference.

6. Enter your First name, last name , Valid Address and Valid phone number , which will be verified.

7. you cannot use same phone number twice

8. Verification process will send otp, Once mobile number verified , Enter the credit Card details.
Please note - it will verify card but wont charge until you confirm to continue with Oracle cloud.

9. Once finished, you will be asked to click on complete signup.

10. Please note : it will take about 15 minute to provision your account










Login to Oracle Cloud .... After Oracle Cloud Promotion Account Creation

$
0
0

This post is in continuation of my previous post.

After you created promotion account, you will receive an confirmation email along with credentials from oracle.


Login to Oracle Cloud

1. Click over the "Get Started with Oracle Cloud" , which redirects to oracle cloud account login page. Enter the credentials you received in your email.

As this is the first time you are logging in , it will prompt you to reset your account password. Reset your password and click on submit



Once you reset, Login to oracle Cloud using : https://cloud.oracle.com/sign-in




OGG-02538 Cannot unregister REPLICAT REPIR because of the following SQL error: OCI Error ORA-00942: table or view does not exist (status = 942)

$
0
0
Unregistering an INTEGRATED REPLICAT from an unsupported Oracle database (11.2.0.3)

OGG-02538  Cannot unregister REPLICAT REPIR because of the following SQL error: OCI Error ORA-00942: table or view does not exist (status = 942).

Database Version: 11.2.0.3
Golden gate Version: 12.2

In this blog we are going to see how to manually remove an integrated replicat after configure on unsupported Oracle Database release 11.2.0.3.

GGSCI> delete REPTMP

2019-04-20 11:47:36  ERROR   OGG-02538  Cannot unregister REPLICAT REPIR because of the following SQL error:

OCI Error ORA-00942: table or view does not exist (status = 942).


There is two option to delete replicat from unsupported oracle database release.

1. Try to delete replicat using force option:

GGSCI> delete  replicat REPTMP !

If may be we are getting the same error message then we need to move second option.

2. Execute dba_xstream_inbound and dba_apply packages:

Connect database using sysdba and run below two select queries.

 select * from dba_xstream_inbound;
 select * From dba_apply;

If above two queries are return any values then need to  execute below two mentioned packages.

This two packages will remove the entries from above two tables.

exec dbms_xstream_adm.drop_inbound('<your inbound server name>');

exec dbms_apply_adm.drop_apply('<your apply name>');

Then we can delete registered replicat without any error.



OGG-01172 Discard file (dirrpt/REPTMP.dsc) exceeded max bytes (20000000).

$
0
0
OGG-01172  Discard file (dirrpt/REPTMP.dsc) exceeded max bytes (20000000).

One of my replicate got abended due to discard file reach max bytes value.

There is two option to resolve this issue.

Option : 1

Take backup of current discard file and purge it.

oracle@test dirrpt]$ du -sh REPTMP.dsc
2GREPTMP.dsc
[oracle@test dirrpt]$ ls -ltr REPTMP.dsc
-rw-r-----. 1 oracle oracle 2000930198 Apr 27 12:42 REPTMP.dsc
[oracle@test dirrpt]$ cp REPTMP.dsc REPTMP_BKP.dsc
[oracle@test dirrpt]$ >REPTMP.dsc
[oracle@test dirrpt]$ cat REPTMP.dsc

Option : 2

To increase size of the discardfile to a higher value.

Edit replicat parameter file and change DISCARDFILE parameter as below:

DISCARDFILE dirrpt/REPTMP.dsc, APPEND, MEGABYTES 4000

Save the replicat parameter file and quit from editor.
Start the replicat.

How to apply weblogic bsu patch

$
0
0
step1:

 Download latest “patch-client-installer310_generic32.jar” from Oracle Support Site

step2:
 
   Go to “bsu” directory of your WLS Installation:
    cd  /opt/app/bea1032/utils/bsu

step3:

  To apply patches run the folowing command from here:
     
$ bsu.sh -install -patchlist=4D53,NIXN,WDJ7,XLXA -                    patch_download_dir=/opt/app/yourLocation/patchesGotFromSupport -verbose -prod_dir=/opt/app/bea1032/wlserver_10.3

step4:

To check which patches are applied

$ bsu.sh -view -patch_download_dir=/opt/app/yourLocation/patchesGotFromSupport -status=applied -verbose -prod_dir=/opt/app/bea1032/wlserver_10.3

How to set initial and max heapsize in weblogic

$
0
0
When we create a managed server either on the same machine or on remote 
machine it gets its initial startup parameters from 
$DOMAIN_HOME/bin/setDomainEnv.sh/cmd file.

By default two parameters are set:


    Xms: The initial heapsize

    Xmx: The max heapsize



Try to set equal initial and max heapsize. The startup time can be a 
little longer but for long running applications it will provide a better
performance.



When we set -Xms512m -Xmx1024m, the physical heap size will be 512m. 
This means that there are pages of memory (in the state of the 512m) 
that the JVM does not explicitly control. It will be controlled by OS 
which could be reserve for the other tasks. In this case, it is an 
advantage if the JVM claims the entire memory at once and try not to 
spend time to extend when more memory is needed. Also you can use 
-XX:MaxPermSize (Maximum size of the permanent generation) option for 
Sun JVM. You should adjust the size accordingly if your application 
dynamically load and unload a lot of classes in order to optimize the 
performance.

how to increase connection timeout in weblogic

$
0
0

We need to follow below steps to set this option : -Dsun.net.client.defaultConnectTimeout=5000) through Weblogic Admin Console.
To set this JVM options using the weblogic administration console:
1.In the Domain Structure pane, expand the Servers node.
2.Click the name of the server that you want to configure.
3.In the right pane, click Server Start.
4.Select Lock & Edit.
5.In the Arguments text box, provide the JVM option: enter the following option :
-Dsun.net.client.defaultConnectTimeout=5000
After inserting your options, click Save. Then click Activate Changes.
NOTE: Here 5000 is in miliseconds.

socket connection timeout weblogic
Viewing all 1640 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>