| siva@mydbsrvr1:/home/oracle $ echo $SHELL |
You can find out what shell you are using by the command: echo $SHELL
Environment Variables in Unix
By prefixing $ to the variable name, you can evaluate it in any command
| siva@mydbsrvr1:/home/oracle $ echo $SHELL |
You can find out what shell you are using by the command: echo $SHELL
Environment Variables in Unix
By prefixing $ to the variable name, you can evaluate it in any command
On ls command use the –a option.
-a Shows you all files, even files that are hidden (these files begin with a dot.)
| ls -a |
Error Message on Trace file
| *** SERVICE NAME:(SYS$USERS) 2011-07-24 00:00:18.201 ORA-12012: error on auto execute of job 11762 |
Cause:
Table DBSNMP.BSLN_BASELINES contains inconsistent information. In this case, after database cloning, existing records in table "DBSNMP.BSLN_BASELINES" conflict with new baseline information inserted in the database.
The DBSNMP user needs to be dropped and re-created.
Solution:
| SQL> @?/rdbms/admin/catnsnmp.sql -- drop user SQL> @?/rdbms/admin/catsnmp.sql -- create user
|
Reference: Oracle ID 736627.1
Ideally, the flash recovery area should be large enough to hold a copy of all of your
needed to recover your database using the data file backups kept under your retention policy.
Setting the size of DB_FILE_RECOVERY_DEST_SIZE must be based on following factors.
1) your flash back retention target,
2) what all files you are storing in flashback and
3) if that includes backup then the retention policy for them or how often you move them to tape
Oracle Internal Space management mechanism for Falshback recovery area itself is designed in such way that if you define your db_recovery_file_dest_size and DB_FLASHBACK_RETENTION_TARGET at a optimal value, you wont need any further administration or management.
If a Flash Recovery Area is configured, then the database uses an internal algorithm to delete files from the Flash Recovery Area that are no longer needed because they are redundant, orphaned, and so forth. The backups with status OBSOLETE form a subset of the files deemed eligible for deletion by the disk quota rules.
When space is required in the Flash Recovery Area, then the following files are deleted:
a) Any backups which have become obsolete as per the retention policy.
b) Any files in the Flash Recovery Area which has been already backed up
to a tertiary device such as tape.
c) Flashback logs may be deleted from the Flash Recovery Area to make space available for other required files.
| Verify the file specification information for the current control file(s): SQL> show parameters control_files |
| If your are using pfile, change CONTROL_FILES to point to the remaining control files. Make sure that the full file specification is used. vi $ORACLE_HOME/dbs/init<SID>.ora. CONTROL_FILES = (/oradata/<sid>/data1/control_01.ctl, /oradata/<sid>/data3/control_02.ctl) If you are using spfile, you may modify the CONTROL_FILES parameter using the ALTER SYSTEM SET command. SQL> alter system set control_files = /oradata/<sid>/data1/control_01.ctl, /oradata/<sid>/data3/control_02.ctl scope=spfile; |
| Shutdown and startup the database. |
| Verify the file specification information for the current control file(s): SQL> show parameters control_files If desired, delete the control file from the O/S. |
Error:
ORA-1652: unable to extend temp segment by 128 in tablespace TEMP Fri Jul 11 01:09:12 2010
What does that error means:
This error is fairly self explanatory - we cannot get enough space for a temporary segment. The size reported in the error message is the number of contiguous free Oracle blocks that cannot be found in the listed tablespace.
How to approach the ORA-1652 error
There are two views in the database that help keep track of the free space in the temporary tablespace: v$sort_usage and v$tempseg_usage (from 9i onwards).
Check the status of the sort segment utilization :
|
|
If USED_BLOCKS = TOTAL_BLOCKS, find which user and statement is using the temporary sort segment by following;
How Do You Find Who And What SQL Is Using Temp Segments
| SELECT a.username, a.sid, a.serial#, a.osuser, b.tablespace, b.blocks, c.sql_text FROM v$session a, v$tempseg_usage b, v$sqlarea c WHERE a.saddr = b.session_addr AND c.address= a.sql_address AND c.hash_value = a.sql_hash_value ORDER BY b.tablespace, b.blocks; |
Resolution
There are two ways of solving this error:
Add more tempfiles, increase the size of the current ones or enable auto extend and the most important:
Tune the queries/statements so that the sort operations are done in memory and not on the disk.
SMON generated the following errors in the alert log file :
SMON: following errors trapped and ignored:
ORA-21779: duration not active
ORA-06512: at line 1
Drop transient type: SYSTPfQMEpjI7QJ7gQ6wVAuBAng==ÿ��
As per Oracle : SMON: Following Errors Trapped And Ignored ORA-21779 [ID 988663.1]
Cause of the error:
This error is caused by SMON not able to clean up some transient types and this problem has been reported a few times in Oracle10gR2
Solution
Other then producing large trace files,this error has no impact,SMON is erroring whilst evaluating a SYSTEM trigger whilst executing cleanup of TYPEs which are no longer needed,so currently we have the following options:
Option 1 --Bounce the DB and see if the error is persistent
OR
Option 2--Also Dev in similar bugs suggested to set the following event at system level to delay the cleanup of these types:
alter system set events '22834 trace name context forever, level 1';
This do not affect database functionality and the only problem is the the alert.log is filling up with many error messages (also after restarting the instance the error should not occur again).
The command "alter system flush shared_pool" could also resolve the problem.
As transient types are created when compiling cursors into memory then it looks like a good idea to execute"alter system flush shared_pool" as this cannot create any problems.
Option 3: Drop the transient type
The existence of the Transient type can be verified by query;
| SELECT * FROM dba_types WHERE type_name LIKE 'SYS%==' AND length(type_name) = 29 |
| select 'drop type "'||s.username||'"."'||o.name||'" FORCE;' |
DROP TYPE "TRACS_USER"."SYSTPZd71k+XjoyfgQG8KQW8u9g==" |
What is this transient type?
How was it created?
Why can't SMON drop it while I, a DBA user, can?
When selecting from a table function which has return type ANYDATASET oracle creates dynamically a type object which matches the actual return type. and sql will cast it automatically to this actual return type, no ANYDATASET output is returned by the select. this mechanism is introduced with oracle 10 in general the smon should cleanup those types.
---- Check if flashback on?
| SELECT flashback_on, log_mode FROM v$database; |
--- Check for Flashback Parameters existing
| set linesize 121 SELECT name, value |
---- Stop the RAC Database , it will stop all the instances of the DB
| srvctl stop database -d sfodb |
--- Start the DB in mount state
| srvctl start instance -d sfodb -i sfo38u1 -o mount |
-- Set the Flashback on
| alter database flashback on; |
--- Open the database
| alter database open; |
--- Start the remaining instances of the RAC
| srvctl start instance -d sfodb -i sfo38u2 -o mount exclusive |
-- Verify the flashback settings
| select INST_ID,Name, FLASHBACK_ON from gv$database; |
Error:
ORA-00257: archive error, Connect internal only, until freed.
followed by
The database is not available due to the following conditions: Stuck Archiver
followed by
Warning: Disk group +DG_UAT_FLASH_01 is 92% used
*Cause:
The archiver process received an error while trying to archive a redo log. If the problem is not resolved soon, the database will stop executing transactions. The most likely cause of this message is the destination device is out of space to store the redo log file.
*Action:
Check archiver trace file for a detailed description of the problem. Also verify that the device specified in the initialization parameter ARCHIVE_LOG_DEST is set up properly for archiving.
Method 1. Without increasing DB_RECOVERY_FILE_DEST_SIZE.
Approach 1: Move the archive log from the FRA to some other location to free up FRA
Step 1: Check whether the database is in archive log mode and automatic archiving is enabled
| SQL> archive log list |
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 5559
Current log sequence 5561
Step 2: As the archive destination is defined by USE_DB_RECOVERY_FILE_DEST, find the archive destination by
| SQL> show parameter db_recovery_file_dest; |
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string +DG_UAT_FLASH_01
db_recovery_file_dest_size big integer 110G
Note the value for db_recovery_file_dest_size. Here it is 11G.
Step 3: Find the space used in flash recovery area by :
| SQL> SELECT * FROM V$RECOVERY_FILE_DEST; |
NAME
--------------------------------------------------------------------------------
SPACE_LIMIT SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
----------- ---------- ----------------- ---------------
+DG_UAT_FLASH_01
1.1811E+11 3.0249E+10 2.7808E+10 1140
Step 4: If SPACE_USED is equal to SPACE_LIMIT of db_recovery_file_dest, move the archive logs to different destination.
Step 5: Archive all the log files
| SQL> alter system archive log all; |
Step 6: Just switch the logs to verify:
| SQL> alter system switch logfile; |
Second Approach: Delete the Archive Log , when it is not needed to free up the DB_RECOVERY_FILE_DEST
Alternatively, we can solve this type of problem without increasing DB_RECOVERY_FILE_DEST_SIZE is to delete (archive log) files from DB_RECOVERY_FILE_DEST if we are sure we have backups and the archived logs are no longer necessary.
| $rman target / |
Method 2: By increasing DB_RECOVERY_FILE_DEST_SIZE.
Step 1: See the path of flash recovery area.
| SQL> show parameter db_recovery_file_dest; |
Step 2: Disable the Flash Recovery Area
| SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST=''; |
Step 3: Increase the Flash Recovery Area
| SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 200g; |
Step 4: Enable the Flash Recovery Area
| SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = ‘+DG_UAT_FLASH_01’; |
Check status of the GRID management server
| 1) export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn 2) cd $ORACLE_HOME/bin 3) ./opmnctl status |
oracle@omsrvrap$ export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn
oracle@omsrvrap$ cd $ORACLE_HOME/bin
oracle@omsrvrap$ opmnctl status
Processes in Instance: EnterpriseManager0.omsrvrap.dbosmsrvr.siva.com
-------------------+--------------------+---------+---------
ias-component | process-type | pid | status
-------------------+--------------------+---------+---------
LogLoader | logloaderd | N/A | Down
HTTP_Server | HTTP_Server | 9146 | Alive
dcm-daemon | dcm-daemon | N/A | Down
OC4J | home | 9147 | Alive
OC4J | OC4J_EM | 9148 | Alive
OC4J | OC4J_EMPROV | 9150 | Alive
OC4J | OCMRepeater | 9151 | Alive
WebCache | WebCache | 9152 | Alive
WebCache | WebCacheAdmin | 9153 | Alive
DSA | DSA | N/A | Down
Stop the GRID management server
| 1) export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn 2) cd $ORACLE_HOME/bin 3) ./opmnctl stopall |
oracle@omsrvrap$ export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn
oracle@omsrvrap$ cd $ORACLE_HOME/bin
oracle@omsrvrap$ opmnctl status
opmnctl: stopping opmn and all managed processes...
Start the GRID management server
| 1) export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn 2) cd $ORACLE_HOME/bin 3) ./opmnctl startall |
opmnctl: starting opmn and all managed processes...
Oracle10g OEM GRID Agent ( emctl )Commands
Check status of the GRID control agent
| 1) export ORACLE_HOME=/app/oracle/product/10g/agent10g 2) cd $ORACLE_HOME/bin 3) ./emctl status agent |
oracle@dbsrvr1$ export ORACLE_HOME=/app/oracle/product/10g/agent10g
oracle@dbsrvr1$ cd $ORACLE_HOME/bin
oracle@dbsrvr1$ ./emctl status agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
---------------------------------------------------------------
Agent Version : 10.2.0.5.0
OMS Version : 10.2.0.5.0
Protocol Version : 10.2.0.5.0
Agent Home : /app/oracle/product/10g/agent10g
Agent binaries : /app/oracle/product/10g/agent10g
Agent Process ID : 20124
Parent Process ID : 20080
Agent URL : https://dbsrvr1.dbsrvr.siva.com:3872/emd/main/
Repository URL : https://hp6600ap.dbsrvr.siva.com:1159/em/upload
Started at : 2010-03-09 12:04:07
Started by user : oracle
Last Reload : 2010-03-09 12:08:39
Last successful upload : 2009-07-09 14:26:42
Total Megabytes of XML files uploaded so far : 291.89
Number of XML files pending upload : 0
Size of XML files pending upload(MB) : 0.00
Available disk space on upload filesystem : 35.13%
Last successful heartbeat to OMS : 2010-03-09 12:26:07
Agent is Running and Ready
STOP the GRID control agent
| 1) export ORACLE_HOME=/app/oracle/product/10g/agent10g 2) cd $ORACLE_HOME/bin 3) ./emctl stop agent |
oracle@dbsrvr1$ export ORACLE_HOME=/app/oracle/product/10g/agent10g
oracle@dbsrvr1$ cd $ORACLE_HOME/bin
oracle@dbsrvr1$ ./emctl stop agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
Stopping agent ... stopped.
START the GRID control agent
| 1) export ORACLE_HOME=/app/oracle/product/10g/agent10g 2) cd $ORACLE_HOME/bin 3) ./emctl start agent |
.
oracle@dbsrvr1$ export ORACLE_HOME=/app/oracle/product/10g/agent10g
oracle@dbsrvr1$ cd $ORACLE_HOME/bin
oracle@dbsrvr1$ /emctl start agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
Starting agent ................................ started.
Error: ORA-00980: synonym translation is no longer valid
Cause:
1. Synonym created on non-existing object by mistake.
2. The synonyms referencing the object is dropped but synonym is not dropped
3. Dropped a user, but the synonyms referencing the objects owned by that dropped user.
Query to find the invalid synonyms
| select * from dba_synonyms s |
select'drop '||decode (s.owner,'PUBLIC','PUBLIC SYNONYM ','SYNONYM'||s.owner||'.')||s.synonym_name||';'fromdba_synonyms swheretable_owner not in('SYSTEM','SYS')anddb_link is nullandnot exists(select 1from dba_objects owhere s.table_owner=o.ownerand s.table_name=o.object_name)The query above generate the script to drop the synonyms whose translation is no longer valid
The OEM Agent files are placed on AGENT_HOME/sysman/log/ by default.
| OEM Agent Log File | Management Agent log file | emagent.log |
| OEM Agent Trace File | Management Agent trace file | emagent.trc |
| OEM Agent startup log file | Management Agent startup log file | emagent.nohup |
After starting the instance, the Oracle software associates the instance with specific database. This is called mounting the database.
Error:
| SQL> ALTER VIEW HR.TMP_TABLE_REORG COMPILE; Warning: View altered with compilation errors. |
How to find out the cause:
Use the query below to find the query which makes the View
| SQL> set long 10000 SQL> set pages 0 SQL> select dbms_metadata.get_ddl('VIEW','TMP_TABLE_REORG','HR') from dual; |
Output will look like;
SQL> select "TABLE_NAME","COLUMN_NAME","CONSTRAINT_NAME","T_TABLE_NAME","START_TIME ","END_TIME","RELOAD_START_TIME","RELOAD_END_TIME","OBJECT_SIZE_MB","T_F_CW02TMP _MB","N_REQ_CW02TMP_MB","PRE_ORIG_ROWCNT","PRE_TMP_ROWCNT","POST_ORIG_ROWCNT","
P OST_TMP_ROWCNT" from REORG_USR.tmp_table_reorg;
OST_TMP_ROWCNT" from REORG_USR.tmp_table_reorg
Try to run the “Select statement” which makes the query. You will get error message as; It means that physical table that view depends on does not exist cause the issue.
| ORA-00942: table or view does not exist |
ASM : is the vertical integration of File system and Volume Manager, specifically built for Oracle Database files.
Advantages:
ASM divides data files into extent. This extent is different from data file extent.
Spread each extents across all the disks. It uses indexes to track the placement of each extent.
Oracle DB Storage Structure
Relationship of Database, Tablespace and Data files
How table data is stored in Oracle Database
Content of Database Data Block
| crsctl status resource ora.asm –f | grep servername |
How to current directory to be displayed in the prompt, while using ASMCMD command?
| asmcmd –p |
-p causes the current directory to be displayed in the prompt.
+ signs denotes the root directory
To list the Disk group details
| ASMCMD [+] > ls -l + |
State Type Rebal Name
MOUNTED EXTERN N DG_Test_DATA_01/
MOUNTED EXTERN N DG_Test_FLASH_01/
To list the sizing information for each Disk group
| ASMCMD [+] > ls -s + |
Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Name
1024 4096 8388608 3407872 665384 0 665384 0 DG_Test_DATA_01/
1024 4096 8388608 524288 152944 0 152944 0 DG_Test_FLASH_01/
To display the content of current directory and its subdirectory
| ASMCMD [+] > ls * |
| ASMCMD [+] > find + *.dbf |