ORA-39167: Tablespace DATA was not found - oracle

I'm getting
ORA-39167: Tablespace DATA was not found.
when trying to run import
impdp whweb10/whweb10 dumpfile=remoteexport.dmp remap_schema=company:wweb10 logfile=no directory=dump_dir table_exists_action=truncate VERSION=10.1 TABLESPACES=DATA,INDX
Anyway I correctly created a DATA tablespace in this way:
CREATE TABLESPACE "DATA"
DATAFILE '/usr/lib/oracle/xe/oradata/XE/data.dbf'
SIZE 1024M;
using the user with system privileges.
Creating again the tablespace data with the whweb10 user gives me
ORA-01543: tablespace 'DATA' already exists
What can be wrong ?

Related

Oracle XE 21c: cannot associate tablespace with user

This is the first time that I am using Oracle.
I am using Oracle XE 21c, within a Docker container (gvenzl/oracle-xe:latest).
I create a tablespace.
I create a user, and I want to associate the previously create tablespace to the use (as default tablespable).
As SYSTEM, I create the tablespace CONCERTO_DATA. Everything is fine:
create TABLESPACE CONCERTO_DATA
datafile 'concerto_data.dbf' size 10M
autoextend on
next 512K
maxsize unlimited;
Then I create the user:
CREATE USER CONCERTO IDENTIFIED BY "password"
TEMPORARY TABLESPACE temp;
GRANT DBA, CREATE ANY TYPE TO CONCERTO;
GRANT EXECUTE ON DBMS_AQADM TO CONCERTO;
GRANT EXECUTE ON DBMS_AQ TO CONCERTO;
GRANT AQ_ADMINISTRATOR_ROLE TO CONCERTO;
GRANT CONNECT TO CONCERTO;
GRANT CREATE TYPE TO CONCERTO;
select username, default_tablespace from dba_users where username = 'CONCERTO';
Everything is fine. The default tablespace associated with the user CONCERTO is USERS.
I try to associate the previously created tablespace CONCERTO_DATA:
alter user CONCERTO default tablespace CONCERTO_DATA;
Then, a get a strange error:
[99999][65048] ORA-65048: erreur détectée lors du traitement de l'instruction DDL en cours dans la base de données pluggable XEPDB1
ORA-00959: le tablespace 'CONCERTO_DATA' n'existe pas
Position: 0
It says that the tablespace CONCERTO_DATA does not exist.
However, the table space exists:
select tablespace_name, con_id, STATUS from cdb_tablespaces WHERE TABLESPACE_NAME='CONCERTO_DATA';
Result is:
CONCERTO_DATA, 1, ONLINE
I have tried to associate the tablespace to the user during the user's creation:
CREATE USER CONCERTO IDENTIFIED BY "password"
DEFAULT TABLESPACE CONCERTO_DATA
TEMPORARY TABLESPACE temp;
But, I get the same error.
I have tried to create the tablespace using the user CONCERTO (instead of SYSTEM). But, I get the same error.
I think that the error is related to the container ID (COND_ID=1).
SELECT CON_ID, NAME FROM V$CONTAINERS;
Result:
1, CDB$ROOT
2, PDB$SEED
3, XEPDB1
I think that the container ID for the tablespace CONCERTO_DATA should be 3 (instead of 1). But I have no idea how to change it.
You probably created the TABLESPACE in the CDB because you forgot to
alter session set container = XEPDB1 ;

Oracle Import Data dump: tablespace: "USERS" already exist

I am trying to import data using impdp in oracle. However, when I tried to import it, it is giving me the following error:
ORA-29349: tablespace "USERS" already exists
Since USERS is the defualt permenant tablespace that contains users objects, I tried to exclude it from the command by adding
"exclude=tablespace:\" IN ('USERS')\""
However, adding that does not help at all as the error remains.
my command looks like following: "impdp SYSTEM/MYPASSWORD#orcl full=Y DIRECTORY=dir dumpfile=mydump.dmp LOGFILE=mydump.dmp.log exclude=tablespace:\" IN ('USERS')\" transport_datafiles='/path/to/file"
Any help is appreciated
Ok, from what I can tell this isn't just a normal "can't create tablespace" error. This error is specific to using transportable tablespaces. In this case you won't be able to ignore. The work around is to rename the existing tablespace:
alter tablespace users rename to users_ts;
Then run your import again so that impdp can "create" the USERS tablespace from the dumpfile.
impdp SYSTEM/MYPASSWORD#orcl full=Y DIRECTORY=dir dumpfile=mydump.dmp LOGFILE=mydump.dmp.log transport_datafiles='/path/to/file'

Invalid file name when importing a DMP file to very different database

I created a completely new Oracle database and I am trying to import a DMP file from a full backup of another database and I am getting several errors.
Command:
impdp system/welcome1 full=yes directory=BACKUPSDR dumpfile=bck_full_AXISPROD_15012018.dmp logfile=bck_full_AXISPROD_15012018.LOG
Error:
Processing object type DATABASE_EXPORT/TABLESPACE
ORA-39083: Object type TABLESPACE failed to create with error:
ORA-02236: invalid file name
Failing sql is:
CREATE UNDO TABLESPACE "UNDOTBS1" DATAFILE SIZE 209715200 AUTOEXTEND ON NEXT 5242880 MAXSIZE 32767M BLOCKSIZE 8192 EXTENT MANAGEMENT LOCAL AUTOALLOCATE
The following doesn't have to be right, but might give you some ideas.
I've formatted a long you posted, just to emphasize --> here:
ORA-02236: invalid file name
CREATE UNDO TABLESPACE "UNDOTBS1"
DATAFILE --> here
SIZE 209715200 AUTOEXTEND ON
NEXT 5242880 MAXSIZE 32767M
BLOCKSIZE 8192 EXTENT
MANAGEMENT LOCAL AUTOALLOCATE
Datafile name is, as you can see, missing. Is it valid?
If you - in the source database - extract DDL used to create tablespaces, such as the following example on my 11g XE, you'll see something like this:
SQL> select dbms_metadata.get_ddl ('TABLESPACE', tablespace_name)
2 from dba_tablespaces;
CREATE UNDO TABLESPACE "UNDOTBS1"
DATAFILE 'C:\ORACLEXE\APP\ORACLE\ORADATA --> here
CREATE TABLESPACE "SYSAUX"
DATAFILE --> here
SIZE 10485760
AUTOEXTEND ON NEXT 104
UNDO tablespace contains datafile name. SYSAUX does not. How come? If you show current value of DB_CREATE_FILES_DEST (which, if set, tells Oracle where to create datafiles by default):
SQL> show parameter DB_CREATE_FILE_DEST;
db_create_file_dest string
you might see something. In my XE, that parameter isn't set.
Therefore, I suppose that IMPDP expected the same datafile location as it was set in the source database. If it doesn't exist, it raised the error.
Could you check it?
If it appears that it is the cause of your problems, you should extract CREATE TABLESPACE commands (as I did), modify datafile names so that they aren't invalid any more and pre-create tablespaces. If you're unsure of how large they should be, run
SQL> select tablespace_name, sum(bytes) / (1024 * 1024) size_in_MB
2 from dba_segments
3 group by tablespace_name;
SYSAUX 643,8125
UNDOTBS1 10,1875
USERS 4,1875
SYSTEM 355,875
Then repeat the IMPDP and exclude tablespaces, such as
exclude=tablespace:"IN ('UNDOTBS1', 'USERS')"
As you can see in the SQL listed, DATAFILE does not have a value. This means that Oracle will try to create a datafile at the default location. If that location is not set, CREATE will fail.
You can check the default location for tablespaces with
SQL> show parameter DB_CREATE_FILE_DEST;
NAME TYPE VALUE
--------------------- -------- ------------------------------
db_create_file_dest string
Above, it has no value. To set the value, use alter system set:
SQL> alter system set DB_CREATE_FILE_DEST='/ORCL/u02/app/oracle/oradata/ORCL/orclpdb1';
System altered.
SQL> show parameter DB_CREATE_FILE_DEST;
NAME TYPE VALUE
--------------------- -------- ------------------------------------------
db_create_file_dest string /ORCL/u02/app/oracle/oradata/ORCL/orclpdb1
Here, /ORCL/u02/app/oracle/oradata/ORCL/orclpdb1 is the path for tables spaces in the first pluggable database (PDB), using the Oracle 12.2.0.1 container from https://container-registry.oracle.com/

Oracle 12c with Data-guard, create PDB failed

There are two databases orcl1&orcl2 with data-guard, db_name is 'orcl', primary db is orcl1. The datafiles path both are '/oracle/orcl/'. I try to create a new PDB 'pdb1' in orcl1. Use command like
create pluggable database pdb1 admin user oracle identified by oracle
default tablespace pdb1 datafile '/oracle/orcl/pdb1/pdb101.dbf' size 20g autoextend on
path_prefix = '/oracle/pdb1/'
file_name_convert =('/oracle/orcl/pdbseed/', '/oracle/orcl/pdb1/');
And then ora-65005, missing or invalid file name pattern file ----/oracle/orcl2/pdbseed/temp01.dbf. Actually it should be '/oracle/orcl/pdbseed/temp01.dbf'. Parameter db_file_name_convert both are empty.How to solve this error or create PDB successfully in this situation?
Try changing the command:
create pluggable database pdb1 admin user oracle identified by oracle
default tablespace pdb1 datafile '/oracle/orcl/pdb1/pdb101.dbf' size 20g autoextend on
path_prefix = '/oracle/pdb1/'
file_name_convert =('/oracle/orcl/pdbseed/', '/oracle/orcl/pdb1/',
'/oracle/orcl2/pdbseed/', '/oracle/orcl/pdb1/'); -- wherever the dg stores its datafiles

Oracle 10g: Error when creating database manually by scripts

My situation is that I have to create a new Oracle database using only scripts (so please do not advice me using DBCA)
My script is as below:
CreateDB.bat
set ORACLE_SID=testdb
oradim -new -sid %ORACLE_SID% -intpwd test -startmode M
copy init.ora D:\oracle\product\10.2.0\db_1\database\inittestdb.ora
sqlplus sys/test as sysdba #D:\Script\CreateDB.sql
==> "init.ora" is the file I copy from the DB created using DBCA
CreateDB.sql
CREATE SPFILE='D:\oracle\product\10.2.0\db_1\dbs\spfiletestdb.ora' FROM
PFILE='D:\oracle\product\10.2.0\db_1\database\inittestdb.ora';
startup nomount PFILE='D:\oracle\product\10.2.0\db_1\database\inittestdb.ora';
create database testdb
logfile group 1 ('D:\oracle\product\10.2.0\oradata\testdb\redo1.log') size 100M,
group 2 ('D:\oracle\product\10.2.0\oradata\testdb\redo2.log') size 100M,
group 3 ('D:\oracle\product\10.2.0\oradata\testdb\redo3.log') size 100M
character set JA16SJIS
national character set AL16UTF16
datafile 'D:\oracle\product\10.2.0\oradata\testdb\system01.dbf'
size 500M
autoextend on
next 100M maxsize unlimited
extent management local
sysaux datafile 'D:\oracle\product\10.2.0\oradata\testdb\sysaux01.dbf'
size 100M
autoextend on
next 100M
maxsize unlimited
DEFAULT TABLESPACE tbs_1
DATAFILE 'D:\oracle\product\10.2.0\oradata\testdb\tbs01.dbf'
SIZE 200M REUSE
DEFAULT temporary TABLESPACE tempts1
tempfile 'D:\oracle\product\10.2.0\oradata\testdb\temp01.dbf'
SIZE 200M REUSE
undo tablespace undotbs
datafile 'D:\oracle\product\10.2.0\oradata\testdb\undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
The above return error [ORA-30012: undo tablespace 'UNDOTBS01.DBF' does not exist or of wrong type].
At first, as i check the init.ora file, I found out that the parameter for UNTO tablespace have different name for UNDO file, so I change it to match the file name in my script.
Old:
undo_management=AUTO
undo_tablespace=UNDOTBS1.DBF
New:
undo_management=AUTO
undo_tablespace=UNDOTBS01.DBF
and delete the database (yes, even when error, the database is still created, just cannot be used) and re-run everthing again, and same error occurs.
I have research for 2 days and still cannot find any solution.
All the script above is following the guide on Oracle website:
http://docs.oracle.com/cd/B19306_01/server.102/b14231/create.htm
The OS is Windows Server 2003.
Database is Oracle 10g Standard Edition.
UPDATED 1:
Thank Mat, UNDO tablespace problem is solved :D
Now, next error pop-up.
Completed: ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMPTS1
Wed May 21 09:11:38 2014
Errors in file d:\oracle\product\10.2.0\admin\testdb\udump\testdb_ora_3416.trc:
ORA-00604: error occurred at recursive SQL level 1
ORA-02236: invalid file name
However, it is actually due to the missing of datafile option for [DEFAULT TABLESPACE tbs_1].
I have update the CREATE script above.
UPDATED 2:
A new problem occurred when I create a user for this database.
I have created a new topic for it on this link:
Oracle 10g: ORA-12154 when connect to database with newly created user
Any help will be appreciated.
The undo_tablespace parameter takes the name of the tablespace, not of the datafile.
You should have
undo_tablespace=UNDOTBS
in your parameter file to match your database creation script.

Resources