Quantcast
Channel: Andrew's Oracle Blog
Browsing all 330 articles
Browse latest View live

ORA-02495

This was tested on Oracle 11.2. If you try to resize a datafile in a read only tablespace, you get an ORA-02495. Changing the tablespace to read write makes the problem go away:  SQL> create...

View Article


Can You Use BETWEEN and a Subquery Together?

I saw a colleague about to throw away his copy of Oracle 7 The Complete Reference so I rescued it from the bin and started to read it (as you do). It said that you could not use BETWEEN and a subquery...

View Article


ORA-13504

This was tested on Oracle 11.2.0.4. If you try to create a database like this i.e. without specifying a SYSAUX datafile clause: create database extent management localdatafile...

View Article

INVALID Materialized View NEEDS_COMPILE

This example was tested on Oracle 11.2. It shows how an on demand materialized view becomes invalid following DML on the underlying table. First I created a table:SQL> create table tab1 (col1...

View Article

ORA-01921

This was tested on Oracle 11.2. If you try to create a role which already exists, you get an ORA-01921: SQL> create role dba  2  /create role dba            *ERROR at line 1:ORA-01921: role name...

View Article


Using RMAN to Clone a Database into a Different Database on the Same Server

This was tested on Oracle 11.2. I had an input or target database as follows: SQL> select name from v$database  2  / NAME---------ORCL1 SQL> l  1  select tablespace_name, file_name  2* from...

View Article

ORA-10636

I tested this in an Oracle 11.2.0.1.0 database. I created a table with lots of data: SQL> create table andrews_table  2  as select * from dba_tables  3  / Table created. SQL> begin  2  for a in...

View Article

How to Automatically Trace a User's Sessions

This example shows how you can use a logon trigger to automatically trace all sessions for a given user. This can be useful where an application is launched from the desktop and then fails before the...

View Article


ORA-12983

If you try to drop all columns in a table, you get an ORA-12983 as you cannot have a table with no columns. You can see what I mean in the examples below, which I ran in an Oracle 11.2 database:SQL>...

View Article


INVALID Materialized View with COMPILATION_ERROR

In this example, Andrew grants access on a table to a role then grants this role to John. John creates a materialized view on Andrew’s table. Andrew updates his table, making John’s materialized view...

View Article

ORA-01442

This was tested on Oracle 11.2. If you define a column as NOT NULL then try to modify it to NOT NULL again, you get an ORA-01442:SQL> create table tab1 (col1 number not null)  2  / Table created....

View Article

Moving a Table Deletes its Statistics

Statistics are important as they help the optimizer to work out the execution plan for a SQL statement. If you move a table, this deletes its statistics so you need to analyze it again afterwards. You...

View Article

ORA-00957

I tested this on Oracle 11.2. If you try to use a column name more than once in an Oracle table, you get an ORA-00957: SQL> create table tab1  2  (col1 number,  3   col1 number)  4  / col1 number)...

View Article


How to Diagnose a Locking Issue

A user ran an update statement and noticed that it did not seem to be doing anything: SQL> conn gordon/bennettConnected.SQL> update andrew.emp  2  set ename = 'COLIN'  3  where ename = 'BRIAN'  4...

View Article

ORA-29339

I discovered a new error today. I was using Data Pump to copy a database from Sun SPARC to X86 and from Oracle 11.1.0.6.0 to 11.2.0.4.0 for testing purposes. I extracted the tablespace creation SQL...

View Article


PLSQL_OPTIMIZE_LEVEL

This parameter controls how much optimization Oracle does to PL/SQL code when it is compiled. In Oracle 10, valid values were 0, 1 and 2: Oracle 10: sqlplus / as sysdba SQL*Plus: Release 10.2.0.3.0 -...

View Article

ORA-12985

If you try to drop a column from a table in a read only tablespace, you get an ORA-12985. If you really need to drop the column, you must put the tablespace back into read write mode first. You can see...

View Article


enq: SQ – contention

This example shows how to deal with the enq: SQ – contention wait event. It was tested on Oracle 11.2. First I created a sequence and queried the amount of time already spent on this wait event:...

View Article

ORA-12899

This was tested on Oracle 11.2. If you try to update a column with a value which is too long, you will get an ORA-12899: SQL> conn andrew/reidConnected.SQL> create table tab1 (first_name...

View Article

How to Rename a Table

I tested this example in Oracle 12.1. First I created a table:SQL> create table fred  2  as select * from user_synonyms  3  where 1 = 2  4  / Table created.SQL>Then I checked its object_id for...

View Article
Browsing all 330 articles
Browse latest View live