[RSS Feed]

Cleanup Oracle FRA

last change: 2014-08-05
Get rid of everything in the FRA: use RMAN

rman target /
RMAN> DELETE ARCHIVELOG ALL;

Or delete just expired logs:
RMAN>crosscheck archivelog all';
RMAN>delete noprompt expired archivelog all;

Use only if you know what you're doing...

permlink: _.at: Cleanup Oracle FRA

Oracle Object Source

last change: 2014-07-01
Looking for the source of triggers and stored procedures?

SELECT * FROM user_source;
SELECT * FROM dba_source;
SELECT * FROM all_source;

permlink: _.at: Oracle Object Source

Failed Index

last change: 2014-03-19
Find an index in the 'failed' state:

select index_name, status, domidx_status, domidx_opstatus
from dba_indexes
where index_type = 'DOMAIN'
and domidx_opstatus = 'FAILED';

permlink: _.at: Failed Index

Oracle Shutdown / Restart

last change: 2014-02-10
Start SQL*Plus:
sqlplus /nolog

And use the following commands to shut an instance down:
SQL> connect system as sysdba;
SQL> shutdown immediate;

Use 'shutdown abort;' in case there are hanging connections/processes, but keep in mind that this kills those processes (i.e. use at your own risk).

Shutdown + Start:
sqlplus /nolog

SQL> connect system as sysdba;
SQL> startup force;

permlink: _.at: Oracle Shutdown / Restart

Oracle: Slow connections

last change: 2013-07-18
If connecting to an Oracle instance is slow but queries themselves are OK try tnsping. If that takes more than 100ms take a look at your DNS configuration.

Check if name resolution works with all DNS servers configured in /etc/resolv.conf. Check for redundant domain entries as well.

Another possible cause may be a large listener log file. Location can be found with 'lsnrctl status'

permlink: _.at: Oracle: Slow connections

Extend TEMP tablespace

last change: 2013-05-29
Add a new file to the temporary tablespace:

ALTER TABLESPACE TEMP ADD TEMPFILE '/path/to/datadir/tempXX.dbf' SIZE 500M AUTOEXTEND ON MAXSIZE 4G;

permlink: _.at: Extend TEMP tablespace

Extend an Oracle tablespace

last change: 2013-05-14
Add a datafile to an existing Oracle tablespace tb_name:

ALTER TABLESPACE tb_name ADD DATAFILE '/path/to/new/datafile.dbf' SIZE 200M AUTOEXTEND ON NEXT 100M MAXSIZE 4000M;

Show all datafiles associated with a tablespace tb_name:
SELECT * FROM dba_data_files WHERE tablespace_name='tb_name';

permlink: _.at: Extend an Oracle tablespace

Create Schema / User manually in Oracle

last change: 2013-04-09
How to create a user TESTUSER with a tablespace TESTUSERTABLESPACE per SQL:
DATABASENAME is the name of the containing database.

-- Here 2 datafiles are used. Adjust as needed:
CREATE SMALLFILE TABLESPACE "TESTUSERTABLESPACE" DATAFILE '/oracle/oradata2/DATABASENAME/testuser.dbf' SIZE 300M REUSE, '/oracle/oradata3/DATABASENAME/testuser.dbf' SIZE 300M REUSE LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

CREATE USER testuser IDENTIFIED BY testpassword DEFAULT TABLESPACE TESTUSERTABLESPACE;
ALTER USER testuser QUOTA UNLIMITED ON TESTUSERTABLESPACE;

GRANT CONNECT, CREATE SESSION, CREATE TABLE TO testuser;
GRANT select, insert, update, delete, alter ON testuser.tabellenname TO testuser;
GRANT select, alter ON testuser.tabellenname_id_seq TO testuser;

-- extend if needed:
ALTER DATABASE DATAFILE '/oracle/oradata2/DATABASENAME/testuser.dbf' RESIZE 500M;
ALTER DATABASE DATAFILE '/oracle/oradata3/DATABASENAME/testuser.dbf' RESIZE 500M;

-- or set auto-extend:
ALTER DATABASE DATAFILE '/oracle/oradata2/DATABASENAME/testuser.dbf' AUTOEXTEND ON;
ALTER DATABASE DATAFILE '/oracle/oradata3/DATABASENAME/testuser.dbf' AUTOEXTEND ON;

permlink: _.at: Create Schema / User manually in Oracle

Look up details by index / constraint name

last change: 2011-03-25
select * from "SYS"."ALL_INDEXES" where index_name like 'constraintname%'

Replace constraintname by the name of your specific piece of interest.

permlink: _.at: Look up details by index / constraint name

ORA-00603: ORACLE server session terminated by fatal error

last change: 2010-08-13
If you keep getting ORA-00603 or ORA-00600 errors on commit, watch out for any materialized views and change them from 'refresh on commit' to 'refresh on demand'.

The error messages look like this:
ORA-00603: ORACLE server session terminated by fatal error
ORA-00600: internal error code, arguments: [4080], [1], [131], [], [], [], [], []

permlink: _.at: ORA-00603: ORACLE server session terminated by fatal error

Optimizing massive DELETE operations

last change: 2009-06-04
Interesting article on how to get optimal performance when deleting vast amounts of data while keeping some records (i.e. no TRUNCATE). Essentially the trick is inserting data to keep into a temporary table using direct-path INSERT on a table without a primary key index.

permlink: _.at: Optimizing massive DELETE operations


all articles represent the sole opinion of their respective author. all content comes without any warranty for correctnes, despite due diligence.