Tag: Osama mustafa
ORACLE Racing Wallpaper: Need a new image on your desktop ?
Change Enterprise manager password for 11g
Steps :
1.Stop the DB Control
On Unix
$ emctl stop dbconsole
On Windows Open a Command Window and type
**> emctl stop dbconsole
2.Check that the DB Control is stopped
On Unix$ emctl status dbconsole
On Windows
Open a Command Window and type
**>emctl status dbconsole
3.Connect to the database as a user with DBA privilege with SQL*Plus and execute:
SQL> alter user sysman identified by ; SQL> connect sysman/[@database_alias] On Unix
$ emctl setpasswd dbconsole
Provide the new SYSMAN password **>: emctl setpasswd dbconsoleProvide the new SYSMAN passwordOn Unix
$ emctl start dbconsole Open a DOS Command Window and type
**>: emctl start dbconsole Thank you
Osama Mustafa Change Oracle Enterprise Manager 10g Password
1.Stop the DB Control
On Unix $ emctl stop dbconsole
On WindowsOpen a Command Window and type**> emctl stop dbconsole
2.Check that the DB Control is stoppedOn Unix
$ emctl status dbconsole
On WindowsOpen a DOS Command Window and type**> emctl status dbconsole
SQL> alter user sysman identified by ;
SQL> connect sysman/[@database_alias]
5.Go to $ORACLE_HOME/host_sid/sysman/config do the following :
- Save the file emoms.properties to emoms.properties.orig
- Edit the file emoms.properties
- Search for the line beginning with:
oracle.sysman.eml.mntr.emdRepPwd=
Replace the encrypted value by the new password value
Example:
oracle.sysman.eml.mntr.emdRepPwd=rainbow - Search for the line:
oracle.sysman.eml.mntr.emdRepPwdEncrypted=TRUE
Replace TRUE by FALSE
6.Restart the DB Control
On Unix
$ emctl start dbconsole Open a DOS Command Window and type**> emctl start dbconsole - Edit the file $ORACLE_HOME/host_sid/sysman/config/emoms.properties
- Search for the line beginning with:
oracle.sysman.eml.mntr.emdRepPwd=
Check that the password is encrypted - Search for the line beginning with:
oracle.sysman.eml.mntr.emdRepPwdEncrypted=
Check that the value is TRUE
I Publish the same lesson but on 11g .
Thank you Osama mustafa
Oracle Statistics Tables.
I am going to talk about Some Oracle Statistics Table that will be useful for tuning your database , and gathering information about your database , these table are very useful
For example Dynamic Performance View :
**The below query will gives you the most sql statement taking more time in the CPU .
1-Select Sql_text , executions from v$sqlstats where cpu_time > 1000 ;
**Below Query Gives you some Details about Specific Machine
2-Select * from v$session where machine = ‘OSAMA_PC’ and where
logon_time > sysdate -1 ;
**finally , Lock in your database
3- select sid,ctime from v$lock where block > 0 ;
Statistics Tables are :
**Display System Wide Statistics :
V$Sysstat
V$Statname
V$Sesstat
V$Sgastat
V$Event_name
V$system_event
**Display Session-Related Statistics
V$statname
V$Session
V$Session _Event
V$Session_Wait
**Display Service-Related Statistics
V$Service_stats
V$Services
V$Service_event
V$Service_wait_Class
V$Session_Wait_Class
V$System_Wait_Class
V$Service_Wait_Class
V$Session_Event : Session Wait By event for each session had to wait .
V$Session_Wait : Session Wait By Event For current active session that are waiting .
V$System_Event : Total waits for an event (All Session Together).
Wait Event : Information About session that had to wait or must wait for Different Reasons (V$Event_name).
Some Other Useful Tables :
-V$SQL
-V$SQLAREA
Thank You
Osama Mustafa
TKPROF And Oracle Trace Analysis
@ORACLE_HOME\rdbms\admin\utlxplan.sql
CREATE PUBLIC SYNONYM PLAN_TABLE FOR SYS.PLAN_TABLE;
GRANT SELECT, INSERT, UPDATE, DELETE ON SYS.PLAN_TABLE TO PUBLIC;
ALTER SESSION SET SQL_TRACE = TRUE;
SELECT COUNT(*)
FROM dual;
ALTER SESSION SET SQL_TRACE = FALSE;
OR Another Way to trace file :
TKPROF
explain=user/password@service table=sys.plan_table
Output will be like :
********************************************************************************
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
********************************************************************************
SELECT COUNT(*)
FROM dual
call count cpu elapsed disk query current rows
------- ----- ----- ------- ------- ------- ------- -------
Parse 1 0.02 0.02 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 0.00 0.00 0 1 4 1
------- ----- ----- ------- ------- ------- ------- -------
total 4 0.02 0.02 0 1 4 1
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 121
Rows Row Source Operation
------- ---------------------------------------------------
1 SORT AGGREGATE
1 TABLE ACCESS FULL DUAL
Thank you
Osama mustafa
Create Enterprise manager for RAC (Real Application Cluster)
Sometimes we need to create enterprise manager for Rac Environment , its the same way for One instance with different Command .
We are here talk about 10g , 11g database .
you follow the below steps to create or recreate enterprise manager LET’S START :
if you already have RAC – enterprise manager and you need to recreate then start from here
Commands :
On Node-1
emctl stop dbconsole .
On Node 2 :
emctl stop dbconsole .
$emca -deconfig dbcontrol db -repos drop -cluster
“you will wait for while until repos been dropped”.
$emca -config dbcontrol db -repos create -cluster
“follow the instsruction and fill the information such as DB SID,Listener Port , Crs Name”
the output will be your crs name .
Thank you
Osama mustafa
Basic Rman (Recovery manager) Guide
Rman is Command line tools that gives you lot of benefits for backup
such as backup database, control file , archive log , create scripts … etc
you can connect to the following types of databases.
Target database :
RMAN connects you to the target database with the SYSDBA privilege. If you do not have this privilege, then the connection fails.
Recovery catalog database:
This database is optional, you can also use RMAN with the default NOCATALOG option.
Auxiliary database :
You can connect to a standby database, duplicate database, or auxiliary instance (standby instance or tablespace point-in-time recovery instance.
Connecting to the Target Database
Information About your Schema And display datafiles Currently In the target database .
To list the backup sets and image copies that you have created, run the list command as follows:
To list image copies, run the following command:
Show Rman Confurgation :
List All the backup has been taken by Rman :
Validate Your backup that has been taken By Rman , to check there’s no corrputed file in it :
RMAN>validate backupset
Take anote that I mention Rman basic command in earlier Blog , Please take a look at it .
And ENJOY .
Thank you
Osama Mustafa
Oracle Stream Stop Replication without any error
‘Archivelog-name’ FOR ‘Capture-name’;
sqlplus /nolog
connect / as sysdba
alter system set events ‘26700 trace name context forever, level 6’;
alter system set events ‘1349 trace name context forever , level 1024’;
exit
sqlplus strmadmin/passwd (streams admin)
exec dbms_capture_adm.set_parameter(‘yourcapturename’,’trace_level’,’127′);
exec dbms_capture_adm.start_capture(‘yourcapturename’);
sqlplus strmadmin/passwd (streams admin)
Stop the capture(DBMS_CAPTURE_ADM.STOP_CAPTURE)
exec dbms_capture_adm.set_parameter(‘yourcapturename’,’trace_level’,null);
exit
sqlplus /nolog
connect / as sysdba
alter system set events ‘26700 trace name context off’;
alter system set events ‘1349 trace name context off’;
exit
1. Stop the capture(DBMS_CAPTURE_ADM.STOP_CAPTURE)
“set trace off after 10-15 mins”:
exec dbms_capture_adm.set_parameter(‘yourcapturename‘,’trace_level’,null);
COLUMN SOURCE_DATABASE HEADING ‘Source|Database’ FORMAT A10
COLUMN SEQUENCE# HEADING ‘Sequence|Number’ FORMAT 99999
COLUMN NAME HEADING ‘Required|Archived Redo Log|File Name’ FORMAT A40
SELECT r.CONSUMER_NAME,
r.SOURCE_DATABASE,
r.SEQUENCE#,
r.NAME
FROM DBA_REGISTERED_ARCHIVED_LOG r, DBA_CAPTURE c
WHERE r.CONSUMER_NAME = c.CAPTURE_NAME AND
r.NEXT_SCN >= c.REQUIRED_CHECKPOINT_SCN
order by 3;
APPLY_FROM_MARKA 4.23.369085 5600212761449 17-OCT-11 1 18-OCT-11
APPLY_FROM_MARKA 56.17.156892 5600242177417 18-OCT-11 1 18-OCT-11
APPLY_FROM_MARKA 4.40.369226 5600243099471 18-OCT-11 1 18-OCT-11
APPLY_FROM_MARKA 24.21.419884 5600247380679 18-OCT-11 15 19-OCT-11
APPLY_FROM_MARKA 14.20.166840 5600278453686 19-OCT-11 1 19-OCT-11
2-exec dbms_apply_adm.set_parameter(‘Apply-process-name’,’_ignore_transaction’,’TXN-Number’);
3-exec sys.purge_spill_txn(‘Apply-process-name’,’TXN-Number’);
4-exec dbms_apply_adm.start_apply(‘Apply-process-name’);
5-exec dbms_apply_adm.set_parameter(‘Apply-process-name’,’_ignore_transaction’,null);
Capture Site:
1-execute dbms_capture_adm.stop_capture(‘capture-Process-name’);
2-execute dbms_capture_adm.set_parameter(‘capture-Process-name’,’_ignore_transaction’,’TXN-Number’);
3-execute dbms_capture_adm.start_capture(‘capture-Process-name’);
exec dbms_capture_adm.set_parameter(‘Capture-procees-name’,’_SGA_SIZE’,’50’);
exec dbms_capture_adm.start_capture(‘Capture-procees-name’);
The above changes space for named capture process : ‘STRMADMIN_CAPTURE’ from 10M -> 50M
Export Data Bump , Import Data Bump In Oracle
Steps :
In Sql Plus (Conn /as sysdba)
CREATE OR REPLACE DIRECTORY "Dir-name" AS "Dir-path";
GRANT READ, WRITE ON DIRECTORY "Dir-path" TO "username";
CREATE OR REPLACE DIRECTORY test_dir AS '/u01/app/oracle/oradata/';
GRANT READ, WRITE ON DIRECTORY test_dir TO scott;
TABLES parameter is used to specify the tables that are to be exported. The following is an example of the table export and import syntax.expdp scott/tiger@db10g tables=EMP,DEPT directory=TEST_DIR
dumpfile=EMP_DEPT.dmp logfile=expdpEMP_DEPT.log
impdp scott/tiger@db10g tables=EMP,DEPT directory=TEST_DIR
dumpfile=EMP_DEPT.dmp logfile=impdpEMP_DEPT.log
FULL parameter indicates that a complete database export is required. The following is an example of the full database export and import syntax.expdp system/password@db10g full=Y directory=TEST_DIR
dumpfile=DB10G.dmp logfile=expdpDB10G.log
impdp system/password@db10g full=Y directory=TEST_DIR
dumpfile=DB10G.dmp logfile=impdpDB10G.log
You can Use For more information :
"expdp help=y"
Or
"impdb help=y"













