Thursday, July 26, 2012

How To EXPORT/IMPORT Full DB in ORACLE

Hi,
If you'd like to make full export for your oracle DB, you can use "EXP" command for this.
Here you see examples for "exp" command:

exp system/manager@xyz FULL=Y FILE=FULL.DMP

Here is EXPORT example by OWNER:
exp system@manager@xyz FILE=File_name.dmp OWNER=Owner_Name


You should drop tables before import:
Create file drop_list.sql


set head off
set pagesize 0
set verify off
set feedback off
spool drop_objects.sql
select 'drop table '||table_name ||';' 
from user_tables
/
spool off

Connect with user/password and run this script: sqlplus owner/owner @drop_list.sql
The script will create file drop_objects.sql - this is a list of tables that should be deleted.



When you should import dumped file to other database you can use "IMP" command.
imp system/manager@xyz FULL=Y FILE=FULL.DMP


Here is IMPORT example by OWNER:
imp system@manager@xyz FILE=File_name.dmp OWNER=Owner_Name


Also you can export/import specific schema with same commands with out "FULL" prefix.

Tuesday, July 24, 2012

How to shrink LOG file in MS-SQL Server 2005/2008


Hi,

There was a problem with Log file was bigger that 40Gb  in my DB.

With these steps I managed to shrink a file:


USE [DBNAME]
GO
CHECKPOINT -- Write checkpoint to the log file, and force SQL to write all dirty pages to the database.
GO
ALTER DATABASE [DBNAME] SET RECOVERY SIMPLE -- Set database to Simple recovery, essentially truncating all the non-active part of the transaction log file.
GO
ALTER DATABASE [DBNAME] SET OFFLINE WITH ROLLBACK IMMEDIATE -- Kill all active transactions/connections rolling back any changes that are outstanding.
GO
ALTER DATABASE [DBNAME] SET ONLINE -- Bring database back online (should have no active connection now).
GO
DBCC SHRINKFILE('LOGICAL_FILE_NAME',0) -- Since we have killed all active transactions, and we have set database to simple recovery mode; all VLF should be in inactive state now; and you should be able to shrink the file.
GO 


Of course you should change backup recovery mode to FULL after this steps.

Friday, July 20, 2012

How to check CPU temperature in Linux

Hi,

If you should check CPU Temperature in Linux
You can use follow command:

cat /proc/acpi/thermal_zone/THM0/temperature
or
cat /proc/acpi/thermal_zone/*/temperature

Good Luck...

Thursday, July 12, 2012

How to create user in Linux.


In this example I'm creating user applprod with bash login option.
You should only change user name & run it with root permissions.

useradd -gdba -s/bin/bash -papplprod -d/home/applprod -m applprod
useradd -gdba -s/bin/bash -poraprod -d/home/oraprod -m oraprod

Tuesday, July 10, 2012

Starting Database Listener gives "Linux Error: 32: Broken pipe"

After attempting to start the listener it is giving following errors
TNS-12547:TNS:lost contact
TNS-12560:TNS:protocol adapter error
TNS-00517:lost contact
Intel SVR4 UNIX Error: 32: Broken pipe

To resolve this issue you should find listener log files location.
1. Login with "ORAUSER" and load environment for this user.
2. cd $TNS_ADMIN
3. Open listener.ora file and find "LOG_DIRECTORY" path.
4. cd to directory found in previous step
5. Check if log size (if log file bigger that 2Gb please delete this file)
6. Start listener.

Thursday, July 5, 2012

How to clear ALL Oracle Application Cache.

1. Login to application with SYSADMIN or different user with sysadmin responsibility.

2. Navigate to -> Functional Administrator


3. Press -> Core Services

4. Press -> Caching Framework

5. Press ->  Global Configuration


6. Press -> Clear All Cache


7. Press -> Yes


8. Press -> Apply


Good Luck...






How to run gather statistics on a table.


You can use analyze command:

analyze table TABLE_NAME compute statistics  
or
analyze table TABLE_NAME estimate statistics 

also you can use "dbms_stats package" follow:

exec dbms_stats.gather_table_stats('ownername','tablename')

Tuesday, July 3, 2012

R12 Renders "Blue" Screen for Users in Right-to-Left Language Enabled Environments

After bouncing Apache and OC4J processes in Release 12 environments the users experience that colors in OA Framework pages are not appear as expected from the SWAN Look and Feel, but have a dark blue background and font(size) used may be smaller or larger.

This problem is experienced in environment having Right-to-Left languages installed like Arabic or Hebrew.

Although E-Business Suite functionality still works as expected the pages are harder to read and causing problems for the users.

Examples:

Wrong:



Good:



The problem is caused by incorrect invalidation of cached information in the UIX layer used to generate the Look-and-Feel of the OA Framework page when switching from LTR to RTL language. Due to this the HTML generated references the wrong style-sheet object and uses this definition (color, font, font size)  instead of the correct style-sheet object.

Solution:

The fix in the UIX layer is delivered in <Patch:10335521> R12.FWK.B THE APPLICATIONS BACKGROUND TURNS COMPLETELY BLUE INTERMITTENTLY.

ORACLE ID:
R12 Renders "Blue"Screen for Users in Right-to-Left Language Enabled Environments [ID 1403454.1]


SQL Server 2005/2008 – Renaming database and physical database files using T-SQL

Step1: Change Database Name



To Rename a database using T-SQL, use below script:
USE [master]
– Set Database to Single-User Mode
ALTER DATABASE [DBNAME] SET  SINGLE_USER WITH ROLLBACK IMMEDIATE
– Rename Database
ALTER DATABASE [DBNAME] MODIFY Name = [DBNAME2]
– Set Database to Multi-User Mode
ALTER DATABASE [DBNAME2] SET  MULTI_USER WITH ROLLBACK IMMEDIATE




Step2: Rename Files.

ALTER DATABASE [ DBNAME2 ]
            MODIFY FILE (NAME='DBNAME', NEWNAME='DBNAME2.mdf')
ALTER DATABASE [ DBNAME2 ]
            MODIFY FILE (NAME='DBNAME_log', NEWNAME='DBNAME2_log')





However, this method can change the physical database file name, you can check this:


SELECT      name, physical_name

FROM        [DBNAME].sys.database_files