Wednesday, 17 July 2013

Transportable tablespace for different datablock size(db block size)

Source:In this machine size of database block is 8K.
1) In source machine create one tablespace TTS and create user  TTS and assign default tablespace to TTS user as TTS tablespace.
2)exec dbms_tts.transport_set_check(‘TTS’);
3)Check for violations  using
Select * from transport_set_violations;
4)keep tablespace TTS in read only
Alter tablespace TTS read only;
5)$ exp file=tts.dmp TABLESPACES=TTS  TRANSPORT_TABLESPACE=Y
Username/password:- sys as sysdba
6)copy dumpfile and datafile to destination machine

Destination:- In this machine size of database block is 4K
Add following parameter in pfile
Db_8K_cache_size=200M
Perform import using below command
[oracle5@fed01 ~]$ imp file=tts.dmp TABLESPACES=TTS TRANSPORT_TABLESPACE=Y DATAF                                                                                        ILES='/u02/oradata/tts/tts01.dbf'
Import: Release 11.2.0.1.0 - Production on Thu Jul 18 04:25:22 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
Username: / as sysdba
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
About to import transportable tablespace(s) metadata...
import done in US7ASCII character set and AL16UTF16 NCHAR character set
. importing SYS's objects into SYS
. importing SYS's objects into SYS
. importing TTS's objects into TTS
. . importing table   "TTS1"
. importing SYS's objects into SYS
Import terminated successfully without warnings.

Note If we don’t mention db_8k_cache_size in pfile it will give following error
Export file created by EXPORT:V11.02.00 via conventional path
About to import transportable tablespace(s) metadata...
import done in US7ASCII character set and AL16UTF16 NCHAR character set
. importing SYS's objects into SYS
. importing SYS's objects into SYS
IMP-00017: following statement failed with ORACLE error 29339:
 "BEGIN   sys.dbms_plugts.beginImpTablespace('TTS',5,'SYS',1,0,8192,1,322450,"
 "1,2147483645,8,128,8,0,1,2147483645,8,1197301176,1,4129,321958,NULL,0,0,NUL"
 "L,NULL); END;"
IMP-00003: ORACLE error 29339 encountered
ORA-29339: tablespace block size 8192 does not match configured block sizes
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_PLUGTS", line 1682
ORA-06512: at "SYS.DBMS_PLUGTS", line 1813
ORA-06512: at line 1
IMP-00000: Import terminated unsuccessfully
[oracle5@fed01 ~]$ oerr ora 29339
29339, 00000, "tablespace block size %s does not match configured block sizes"
// *Cause:  The block size of the tablespace to be plugged in or
//          created does not match the block sizes configured in the
//          database.
// *Action:Configure the appropriate cache for the block size of this
//         tablespace using one of the various (db_2k_cache_size,
//         db_4k_cache_size, db_8k_cache_size, db_16k_cache_size,
//         db_32K_cache_size) parameters.


Monday, 15 July 2013

oracle apps disable or enable maintenance mode in non interactive mode in oracle applications R12


To enable maintenance mode:

$ cd $AD_TOP/patch/115/sql
$ sqlplus apps/apps
$ @adsetmmd.sql enable;

To disable maintenance mode :

$ cd $AD_TOP/patch/115/sql
$ sqlplus apps/apps
$ @adsetmmd.sql disable;

To enable or disable maintenance mode  using adadmin

http://learnappsdbaskills.blogspot.in/2013/04/disable-maintenance-mode.html


How to speedup copying files using scp command in LINUX

scp output.dat 192.168.111.11:/tmp/               2%   27MB   5.2MB/s   03:01 ETA
scp -c blowfish output.dat 192.168.111.11:/tmp/   6%  100MB   6.8MB/s   02:52 ETA
scp -c arcfour output.dat 192.168.111.11:/tmp/   24%  235MB   7.2MB/s   01:42 ETA



To clear history in linux--------history -c

arcfour, blowfish, how to copy files faster in linux, imp command for dba, LINUX, Oracle, oracle dba, PERFORMANCE TUNING, scp, scp command in linux, scp make fast, speedup scp command, 

Saturday, 13 July 2013

Existing databases as of today..........


DBMSCompanyFrom
4th Dimension4D S.A.S1984
ADABASSoftware AG1970
Adaptive Server EnterpriseSybase1987
Advantage Database ServerSybase1992
AltibaseAltibase Corp.2000
Apache DerbyApache2004
AsqlMarko Tasic2009
DatacomCA Inc.---
DB2IBM1982
DBISAMElevate Software---
DatawaspSignificant Data Systems2008
ElevateDBElevate Software---
FileMakerFileMaker1984
FirebirdFirebird project2000
InformixIBM 1985
HSQLDBHSQL Development Group2001
H2H2 Software2005
IngresIngres Corp.1974
InterBaseCodeGear1985
LucidDBThe Eigenbase Project2007
MaxDBSAP AG---
Microsoft AccessMicrosoft1992
Microsoft Visual FoxproMicrosoft---
Microsoft SQL ServerMicrosoft1989
MonetDBThe MonetDB Developer Team2004
MySQLOracle Corporation(previously Sun)1996
HP NonStop SQLHP1987
Omnis StudioTigerLogic Inc1982
OpenBase SQLOpenBase International1991
OracleOracle Corporation1979
Oracle RdbOracle Corporation1984
OpenEdgeProgress Software
Corporation
1984
OpenLink VirtuosoOpenLink Software1998
Pervasive PSQL/BitrievePervasive Software---
Polyhedra DBMSENEA AB1993
PostgreSQLPostgreSQL Global
Development Group
1989
Pyrrho DBMSUniversity of Paisley2005
RBaseRBase---
RDM EmbeddedBirdstep Technology1984
RDM ServerBirdstep Technology1990
ScimoreDBScimore2005
SmallSQLSmallSQL2005
SQL AnywhereSybase1992
SQLiteD. Richard Hipp2000
SuperbaseSuperbase1984
TeradataTeradata1984
ValentinaParadigma Software1998


source---
http://satya-dba.blogspot.in/2009/06/databases-in-world.html

How to speedup utlrp.sql script after catupgrd.sql scripts

How to compile invalid objects faster:-


To know Invalid objects issue

select count(*) from dba_objects where status like 'INVALID';

To compile these invalid objects faster than normal case then issue following command in sql prompt

SQL>@?/rdbms/admin/utlrp.sql n;

Where n= no of CPU's + 2

This will compile your invalid objects faster than normal case.

Friday, 12 July 2013

Block Change Tracking file



RMAN's change tracking feature for incremental backups improves incremental backup performance by recording changed blocks in each datafile in a change tracking file. If change tracking is enabled, RMAN uses the change trackingfile to identify changed blocks for incremental backup, thus avoiding the need to scan every block in the datafile.

Change tracking is disabled by default, because it introduces some minimal performance overhead on database during normal operations. However, the benefits of avoiding full datafile scans during backup are considerable, especially if only a small percentage of data blocks are changed between backups. If backup strategy involves incremental backups, then we should enable change tracking.

One change tracking file is created for the whole database. By default, the change tracking file is created as an Oracle managed file in DB_CREATE_FILE_DEST. We can also specify the name of the block change tracking file, placing it in any desired location.

Using change
 tracking in no way changes the commands used to perform incremental backups, and the change trackingfiles themselves generally require little maintenance after initial configuration.

From Oracle 10g, the background process Block Change Tracking Writer (CTWR) will do the job of writing modified block details to block change tracking file.

In a Real Applications Clusters (RAC) environment, the change tracking file must be located on shared storage accessible from all nodes in the cluster.

Oracle saves enough change-tracking information to enable incremental backups to be taken using any of the 8 most recent incremental backups as its parent.

Although RMAN does not support backup and recovery of the change-tracking file itself, if the whole database or a subset needs to be restored and recovered, then recovery has no user-visible effect on change tracking. After the restore and recovery, the change tracking file is cleared, and starts recording block changes again. The next incremental backup after any recovery is able to use change-tracking data.

After enabling change
 tracking, the first level 0 incremental backup still has to scan the entire datafile, as the changetracking file does not yet reflect the status of the blocks. Subsequent incremental backup that use this level 0 as parent will take advantage of the change tracking file.



Enabling and Disabling Change Tracking

We can enable or disable change tracking when the database is either open or mounted. To alter the change tracking setting, we must use SQL*Plus to connect to the target database with administrator privileges.

To store the change tracking file in the database area, set DB_CREATE_FILE_DEST in the target database. Then issue the following SQL statement to enable change tracking:
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;  

We can also create the change
 tracking file in a desired location, using the following SQL statement:
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '/u02/rman/rman_change_track.f';

The 
REUSE option tells Oracle to overwrite any existing file with the specified name.
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '/u02/rman/rman_change_track.f' REUSE;

To disable change
 tracking, use this SQL statement:
SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;  

If the change
 tracking file was stored in the database area, then it will be deleted when we disable change tracking.

Checking Whether Change Tracking is enabled
From SQL*Plus, we can query V$BLOCK_CHANGE_TRACKING to determine whether change tracking is enabled or not. 

SQL> select status from V$BLOCK_CHANGE_TRACKING;
        ENABLED   => block change tracking is enabled.
        DISABLED  => block change tracking is disabled.

Query V$BLOCK_CHANGE_TRACKING to display the filename.
SQL> select filename from V$BLOCK_CHANGE_TRACKING;

Moving the Change Tracking File
If you need to move the change tracking file, the ALTER DATABASE RENAME FILE command updates the control file to refer to the new location.

1.
 If necessary, determine the current name of the change tracking file:

SQL> SELECT filename FROM V$BLOCK_CHANGE_TRACKING;
        /u02/rman/rman_change_track.f

2.
 Shutdown the database.
SQL> SHUTDOWN IMMEDIATE

3.
 Using host operating system commands, move the change tracking file to its new location.
$ mv /u02/rman/rman_change_track.f /u02/rman_new/rman_change_track.f

4.
 Mount the database and move the change tracking file to a location that has more space. For example:

SQL> ALTER DATABASE RENAME FILE '/u02/rman/rman_change_track.f' TO '/u02/rman_new/rman_change_track.f';

5.
 Open the database.
SQL> ALTER
 DATABASE OPEN;

SQL> SELECT filename FROM V$BLOCK_CHANGE_TRACKING;
        /u02/rman_new/rman_change_track.f
If you cannot shutdown the database, then you must disable change tracking and re-enable it, at the new location:
SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '/u02/rman_new/rman_change_track.f';

If you choose this method, you will lose the contents of the change tracking file. Until the next time you complete a level 0 incremental backup, RMAN will have to scan the entire file.

Estimating Size of the , on Disk
The size of the change tracking file is proportional to the size of the database and the number of enabled threads of redo. The size is not related to the frequency of updates to the database.

Typically, the space required for block change tracking is approximately 1/30,000 the size of the data blocks to be tracked. The following two factors that may cause the file to be larger than this estimate suggests:
·                     To avoid overhead of allocating space as database grows, the change tracking file size starts at 10MB, and new space is allocated in 10MB increments. Thus, for any database up to approximately 300GB the file size is no smaller than 10MB, for up to approximately 600GB the file size is no smaller than 20MB, and so on.

·                     For each datafile, a minimum of 320K of space is allocated in the change tracking file, regardless of the size ofthe file. Thus, if you have a large number of relatively small datafiles, the change tracking file is larger than for databases with a smaller number of larger datafiles containing the same data.

Tuesday, 9 July 2013

how to add customization to apache configuration file.

Overview

As we know AutoConfig is a tool that simplifies and standardizes configuration management tasks in an Oracle Applications environment.
The configuration generated by AutoConfig may not always meet your specific requirements and it may be necessary to customize AutoConfig to get your environment up and running.

Steps to preserve autoconfig:


First find template file for apache configuration file using adtmplreport.sh script located in $AD_TOP/bin



[applmgr3@fed01 ~]$ cd $AD_TOP/bin
[applmgr3@fed01 bin]$ ls adtmplreport.sh
adtmplreport.sh
[applmgr3@fed01 bin]$ adtmplreport.sh
Usage:
        adtmplreport.sh [help]
        adtmplreport.sh contextfile=<contextfilepath> [log=<logfilepath>]
                [[listcustom] | [product=<product>[listcustom] ]]|
                [target=<targetfilepath>|template=<templatefilepath>]
                [verbose]

Valid arguments for adtmplreport.sh:
        help            : prints usage information
        contextfile     : Complete path to Applications context file.
        log             : Complete path to the Log file to log the
                          information. If not specified, the file will
                          be created automatically in
                          [apps tier]
                          $INST_TOP/admin/log directory
                          [db tier]
                          $ORACLE_HOME/appsutil/log/<s_contextname> directory
        product        : Product to be reported
        template       : Location of template file to be reported on
        target         : Location of target file to be reported on
        verbose        : Displays the output on the screen.
        listcustom     : Lists customizations.

[applmgr3@fed01 bin]$ adtmplreport.sh contextfile=$CONTEXT_FILE target=/u03/applmgr3/inst/apps/PROD_fed01/ora/10.1.3/Apache/Apache/conf/httpd.conf

#########################################################################
          Generating Report .....
#########################################################################
For details check log file: /u03/applmgr3/inst/apps/PROD_fed01/admin/log/07102203.log

[applmgr3@fed01 bin]$ cat /u03/applmgr3/inst/apps/PROD_fed01/admin/log/07102203.log
=================================================================
Starting Utility to Report on Templates and their  Targets  at Wed Jul 10 22:03:28 IST 2013
Using ATTemplateReport.java version 120.0


[ INFO_REPORT ]

[FND_TOP]
TEMPLATE FILE   : /u03/applmgr3/apps/apps_st/appl/fnd/12.0.0/admin/template/httpd_conf_1013.tmp
TARGET FILE     : /u03/applmgr3/inst/apps/PROD_fed01/ora/10.1.3/Apache/Apache/conf/httpd.conf



Modify the configuration file(target file - httpd.conf) as per requirement.For xample add some lines to conf file
“RedShore Technologies---Ameerpet”

Now change the customisation in template file


Key points:-
 Sometimes patch brings new version of template files. Template files will be copied to Standard
template file location rather than Custom template file location. So, in these conditions AutoConfig
fails with conflicts error.

 Whenever we are getting AutoConfig version conflicts, we need to take a backup of existing custom
directory template file and we have to copy new Standard template file to custom directory and we
can add customizations to the file.

 You cannot customize all AutoConfig template files. The AutoConfig templatefile cannot be customized if the “LOCK” keyword appears in the template file’s entry in the

product driver file.

 AutoConfig ignores custom template files that are marked with “LOCK”.


Sunday, 7 July 2013

What happens during RMAN active duplicate cloning in oracle


In an active duplication process, target database online image copies and archived redo log files were copied through the auxiliary instance service name. So we no need the target database backup.
Target database must be in archive log mode.
Database duplication process RMAN does the following things
1.Generate the unique DBID for auxiliary database.
2.Copy the data files & archived log files from target database to auxiliary database.
3.Recreate the new control files for auxiliary database.
4.Recreates the online redo log files.
5.Restart the auxiliary instance.
6.Open the database with RESETLOGS.

Monday, 1 July 2013

How to find out Apps password when we dont know the old password.

How to find out Apps password when we dont know the old password.


The below methog helps us to find out when we lost the Apps password, Please note you need have system password to perform the below actions.The below method is not suggested for Production or Critical systems.

Login to Middle Tier as ap user.
-------------------------------

$cd $FND_TOP/patch/115/sql

$cp AFSCJAVS.pls AFSCJAVS.pls.orig

Add following lines to the AFSCJAVS.pls file

CREATE OR REPLACE PACKAGE apps.fnd_web_sec AS

/*--------------------------------------------------------------*/

function decrypt(key in varchar2, value in varchar2)
return varchar2;

/*--------------------------------------------------------------*/

$sqlplus system/ @AFSCJAVS.pls

Package created.

Commit complete.

as system excute the following to find out if anything marked as invalid.

SQL> show user
USER is "SYSTEM"

SQL>col OBJECT_NAME for a30;
set line 200;
select object_name,object_type,status,owner from dba_objects where object_name='FND_WEB_SEC';


SQL>col OBJECT_NAME for a30;
set line 200;
select object_name,object_type,status,owner from dba_objects where object_name='FND_WEB_SEC';

OBJECT_NAME OBJECT_TYPE STATUS OWNER
------------------------------ ------------------ ------- ------------------------------
FND_WEB_SEC PACKAGE VALID APPS
FND_WEB_SEC PACKAGE BODY INVALID APPS

SQL> alter PACKAGE apps.FND_WEB_SEC compile body;

Package body altered.

If there are any invalids compile them.

Obtain Guest user ID and password.

as system excute the following.

SQL> show user
USER is "SYSTEM"

SQL> select profile_option_value from apps.fnd_profile_option_values where
profile_option_id = (select profile_option_id from apps.fnd_profile_options where
profile_option_name='GUEST_USER_PWD');
2 3
PROFILE_OPTION_VALUE
----------------------------------------------------------------------------------------------------
GUEST/ORACLE

SQL> show user
USER is "SYSTEM"

SQL>create synonym FND_WEB_SEC_TEST for apps.FND_WEB_SEC;

Synonym created.

SQL> show user
USER is "SYSTEM"
SQL> create synonym FND_WEB_SEC_TEST for apps.FND_WEB_SEC;

Synonym created.

-- Now Obtain Apps password using the below sql :)

SQL> SELECT(
SELECT
fnd_web_sec_test.decrypt('GUEST/ORACLE',encrypted_foundation_password)
FROM dual
)AS APPS_PASSWORD
FROM
apps.fnd_user
WHERE
user_name like 'GUEST'; 2 3 4 5 6 7 8 9


APPS_PASSWORD
----------------------------------------------------------------------------------------------------
APPS

-- WOW we got the Apps password now


SQL> drop synonym FND_WEB_SEC_TEST;

Synonym dropped.

-bash-3.2$ sqlplus apps/ @AFSCJAVS.pls

Package created.

Commit complete.

Please find the below explanation for the above steps:
---------------------------------------------------------------

A)
We know in Oracle Applications passwords are stored in FND_USER and FND_ORACLE_USERID tables,The FND_USER table stores application user account passwords and
the FND_ORACLE_USERID table stores internal Oracle Applications database account passwords,Both tables use the same encryption algorithm to protect the passwords.

The FND_USER table contains all the application accounts.There are two password columns in this table: ENCRYPTED_FOUNDATION_PASSWORD and ENCRYPTED_USER_PASSWORD.

====================================================
Column Value Encryption Key
===================================================
ENCRYPTED_FOUNDATION_PASSWORD APPS username/password
ENCRYPTED_USER_PASSWORD user APPS password


The 2 columns as...

a)If we know the username/password we can get the Apps Password (ENCRYPTED_FOUNDATION_PASSWORD)
b)If we know the Apps password we can get any users password (ENCRYPTED_USER_PASSWORD)

B)

To decrypt and verify user passwords Oracle Apps uses FND_WEB_SEC package in Apps.The DECRYPT function in the FND_WEB_SEC package is a local function and cannot be called from outside the package.

So to make the function available outside the package,we have altered the AFSCJAVS.pls above.

11g R2 RAC: CONVERT NON RAC DATABASE TO RAC DATABASE USING RCONFIG


for RAC basics click on below URL

http://learnappsdbaskills.blogspot.in/2013/06/rac-basics.html




Oracle supports the following methods to convert a single-instance database to an RAC database as long as the RAC and the standalone environments are running on the same operating system and using the same oracle release:


• DBCA


• Oracle E

nterprise Manager (grid control)


• RCONFIG


• Manual method


In this post, I will focus on and demonstrate this using the rconfig command-line tool.


During the conversion, rconfig performs the following steps automatically:


• Migrating the database to ASM, if specified


• Creating RAC database instances on all specified nodes in the cluster


• Configuring the Listener and NetService entries


• Registering services with CRS


• Starting up the instances and listener on all nodes


In Oracle 11g R2., a single-instance database can either be converted to an administrator-managed cluster database or a policy-managed cluster database.


When you navigate through the $ORACLE_HOME/assistants/rconfig/sampleXMLS, you will find two sample XML input files.


- ConvertToRAC_AdminManaged.xml


- ConvertToRAC_PolicyManaged.xml


While converting a single-instance database, with filesystem storage, to an RAC database with Automatic Storage Management (ASM), rconfig invokes RMAN internally to back up the database to proceed with converting non-ASM to ASM. Therefore, configuring parallel options to use multiple RMAN channels in the


RMAN on the local node may make backup run faster, which eventually reduces the conversion duration. For example, you may configure the following in the RMAN settings of orcl database on the local node.


RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 6;


CURRENT SCENARIO:


- 3 node RAC setup


- Names of nodes : Host01, Host02, Host03


- Name of single instance database with filesystem storage : orcl


- Source Oracle home : /u01/app/oracle/product/11.2.0/dbhome_1


- Target Oracle home : /u01/app/oracle/product/11.2.0/dbhome_1


OBJECTIVE


- convert orcl to a Admin managed RAC database running on two nodes host01 and host02.


- change storage to ASM with


. Datafiles on +DATA diskgroup


. Flash recovery area on +FRA diskgroup


IMPLEMENTATION:


– copy ConvertToRAC_AdminManaged.xml to another file my.xml


host01$cd $ORACLE_HOME/assistants/rconfig/sampleXMLs


host01$cp ConvertToRAC_AdminManaged.xml my.xml


– Edit my.xml and make following changes :


. Specify current OracleHome of non-rac database for SourceDBHome


. Specify OracleHome where the rac database should be configured. It can be same as SourceDBHome


. Specify SID of non-rac database and credential. User with sysdba role is required to perform conversion


. Specify the list of nodes that should have rac instances running for the Admin Managed Cluster Database. LocalNode should be the first node in this nodelist.


. Instance Prefix tag is optional starting with 11.2. If left empty, it is derived from db_unique_name


. Specify the type of storage to be used by rac database. Allowable values are CFS|ASM


. Specify Database Area Location to be configured for rac database.


. Specify Flash Recovery Area to be configured for rac database.


– Run rconfig to convert orcl from single instance database to 2 instance RAC database


host01$rconfig my.xml


– Check the log file for rconfig while conversion is going on


oracle@host01$ls -lrt $ORACLE_BASE/cfgtoollogs/rconfig/*.log


tailf


– check that the database has been converted successfully


host01$srvctl status database -d orcl


Instance orcl1 is running on node host01


Instance orcl2 is running on node host02


– Note that rconfig adds password file to all the nodes but entry to tnsnames.ora needs to be modified (to reflect scan name instead of host-ip) on the local node and added to rest of the nodes.


– For all other nodes, copy the entry for the database (orcl) from tnsnames.ora on local node to tnsnames.ora on remote node(s).


– Following is the entry I modified on the local node and copied to rest of the nodes :


ORCL =


(DESCRIPTION =


(ADDRESS = (PROTOCOL = TCP)(HOST = cluster01-scan.cluster01.example.com)(PORT = 1521))


(CONNECT_DATA =


(SERVER = DEDICATED)


(SERVICE_NAME = orcl)


)


)


– check that database can be connected remotely from remote node.


host02$sqlplus system/oracle@orcl


– check that datafiles have converted to ASM


SQL>select name from v$datafile;


NAME


——————————————————————————–


+DATA/orcl/datafile/system.326.794838279


+DATA/orcl/datafile/sysaux.325.794838349


+DATA/orcl/datafile/undotbs1.305.794838405


+DATA/orcl/datafile/users.342.794838413


+DATA/orcl/datafile/undotbs2.348.794838


———————————————————————————————————–