Running oracle commands script file from java application - oracle

I have an application which has an oracle database, so the installation of the application needs running some oracle commands script files to create the database and perform some DDL operations. Those operations include some table space creation, schema definition etc.
I was trying to prepare an installation wizard using java application. This wizard needs to run these commands. My specific question is: How to run oracle commands script files from inside my java application? I exactly need a java function that takes the sql commands file path as input parameter and executes the commands within the script files from java taking into the eye of consideration that some parameters (e.g. some user-selected names)must be passed to the script file which to be executed
I used to use PL/SQL command line functionality to execute the sql commands as a privileged user.
Here is a section of the file as an example
ACCEPT TS_NAME CHAR PROMPT 'Enter Table Space Name : '
ACCEPT DB_DATAFILE CHAR PROMPT 'Enter DataBase File full path : '
ACCEPT DB_SIZE NUMBER PROMPT 'Enter DataBase File Size (MB) : '
ACCEPT DB_USER CHAR PROMPT 'Enter User Name : '
ACCEPT DB_PASS CHAR PROMPT 'Enter Table Password Name: ' HIDE
ACCEPT DB_TNSNAME CHAR PROMPT 'Enter DATABASE TNSNAME:'
ACCEPT DB_LOG_PATH CHAR PROMPT 'Enter Log File Path : '
PROMPT Create Tablespace
pause Press Return to continue ...
CREATE TABLESPACE &TS_NAME DATAFILE '&DB_DATAFILE' SIZE &DB_SIZE M
AUTOEXTEND ON NEXT 1M MAXSIZE UNLIMITED LOGGING PERMANENT
EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT MANUAL;
PROMPT Create User
pause Press Return to continue ...
CREATE USER &DB_USER IDENTIFIED BY &DB_PASS DEFAULT TABLESPACE &TS_NAME PROFILE DEFAULT
QUOTA UNLIMITED ON USERS;
COMMIT;
GRANT CONNECT TO &DB_USER;
GRANT RESOURCE TO &DB_USER;
COMMIT;

I would first correct something from your question, the snippet is not PL/SQL but client-side extension by sqlplus and also you are doing a mistake "committing" after a DDL, you don't need to do that as DDL are not part of a transaction.
The best here I think is converting to actual PL/SQL, say a procedure:
create procedure create_user(ts_name in varchar, db_datafile in varchar, db_size in varchar, db_user in varchar,
db_pass in varchar, db_tnsname in varchar, db_log_path in varchar)
is
begin
execute immediate 'CREATE TABLESPACE '||TS_NAME||' DATAFILE '|| db_datafile ||' SIZE ' ||db_size||'M'||
'AUTOEXTEND ON NEXT 1M MAXSIZE UNLIMITED LOGGING PERMANENT '||
'EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT MANUAL';
execute immediate 'CREATE USER '||DB_USER||' IDENTIFIED BY '||DB_PASS||' DEFAULT TABLESPACE '||TS_NAME||' PROFILE DEFAULT QUOTA UNLIMITED ON USERS';
execute immediate 'grant connect, resource to '||db_user;
end;
/
and then from java just recall the procedure with the appropriate parameters, of course you should check the result of all the statements, mine is just an example and needs to be tested and completed with error checks.

Related

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/

create table in postgresql fails - tablespace issue

I am trying to create a the following table in postgresql
CREATE TABLE retail_demo.categories_dim_hawq
(
category_id integer NOT NULL,
category_name character varying(400) NOT NULL
)
WITH (appendonly=true, compresstype=quicklz) DISTRIBUTED RANDOMLY;
I am getting the following error:
ERROR: cannot get table space location for content 0 table space 1663
(catalog.c:97)
I tried to create a new tablespace, I got the following:
ERROR: syntax error at or near "LOCATION" LINE 1: create TABLESPACE
moha LOCATION "/tmp/abc";
Thanks in advance,
Moha.
I got the answer
you’ll need to create a filespace, tablespace, database, and then create the table to do this follow the following steps:
12. If you are on the default database (using plsql command), you can get out to root db user (gpadmin) using CTRL + D.
13. gpfilespace -o .
14. enter the name of the filespace: hawqfilespace3
15. Choose filesystem name for this filespace: hdfs
16. Enter replica num for filespace: 0
17. Specify the HDFS location for the segments: bigdata01.intrasoft.com.jo:8020/xd
Note that /xd is one of Hadoop directories which has read write access.
18. The system will generate a configuration command to you, just execute it.
19. Copy and paste the command and click on enter to execute it.
20. The file space is now created successfully.
21. Now connect to the Database using the psql command.
22. Now create a tablespace on the file space you created.
create TABLESPACE hawqtablespace3 FILESPACE hawqfilespace3;
23. Create a database on this tablespace using the command.
CREATE DATABASE hawqdatabase3 WITH OWNER gpadmin TEMPLATE=template0 TABLESPACE hawqtablespace3;
24. Now you need to connect to the database you created, but first click CTRL + D to exit the user you are in.
25. Enter the command psql hawqdatabase3

Generating procedure logfile and inserting date time

Friends...
DB: Oracle11gR2
OS: Linux
I have created package with couple of procedure, procedure executes alter table move... , index rebuild command on database.
I'm doing below
Run ksh shell script -> execute procedure
Procedure runs alter table, rebuild index commands on database
Procedure completes
Shell script ends.
I can generate logfile for the shell script but whatever gets executed by procedure doesn't get recorded inside shell script logfile. I understood since db session created by procedure it won't record anything in shell logfile.
So how can I
Record everything in logfile which is executed by both procedures in the same package?
Also trying to put current datetime within procedure dmbs_out.put_line command?
Is it possible to run both procedure after connecting database once instead of 2 time connecting database and executing procedure?
There might be table/table partition move syntax error but I'm only trying to trap when table move started and when finished with datetime so to identify total time taken.
*** ksh script
#!/bin/ksh
...
...
...
$LOG_FILE = move_tbs.log
echo -e "set serveroutput on\n exec move_tbs.moveTable;"|$ORACLE_HOME/bin/sqlplus/#db_alias | head -l
echo -e "set serveroutput on\n exec move_tbs.moveTablePart;"|$ORACLE_HOME/bin/sqlplus/#db_alias | head -l
DB Package / Procedure
*** Procedure
create or replace package move_all
procedure moveTable
dbms_output.put_line("CURRENT TIME" 'alter table '|| owner || '.' || table_name || 'move');
Execute immediate 'alter table '|| owner || '.' || table_name || 'move';
dbms_output.put_line("COMPLETED TIME" : CURRENT_TIME);
end moveTable;
-------------------------------------------
procedure moveTablePart
dbms_output.put_line("CURRENT TIME" 'alter table '|| owner || '.' || table_name || 'move');
Execute immediate 'alter table '|| owner || '.' || table_name || 'move partition';
dbms_output.put_line("COMPLETED TIME" : CURRENT_TIME);
end moveTablePart;
end move_all
/
You could just put both exec commands in your echo construct. But you can use a 'heredoc' to simplify running both together, and it's a easier to read and maintain too. Something like:
LOG_TBS_MOVE=move_tbs.log
(
$ORACLE_HOME/bin/sqlplus -s -l user/passwd#db_alias <<!EOF
set serveroutput on
exec move_tbs.moveTable;
exec move_tbs.moveTablePart;
exit
!EOF
) > $LOG_TBS_MOVE
The herdoc start and end markers in this example !EOF - have to match exactly. They can be anything you like as long as there's no chance of anything inside the heredoc accidentally ending it. And the end marker has to be at the start of a line, it can't be indented.
The parentheses around the SQL*Plus and heredoc can enclose multiole commands and all output from within them goes into the log. They aren't really necessary here as there is only one command inside but it's a fairly clear way of doing the redirection, I think.
I'm only putting stdout into the $LOG_TBS_MOVE file; anything on stderr (which will not include any SQL errors) will still go to screen or to your main log if you redirect stderr for that.
To show the time in your output, don't enclose the current_time part in quotes, use string concatenation, and use the right function:
dbms_output.put_line(to_char(sysdate, 'HH24:MI:SS') ||
'alter table '|| owner || '.' || table_name || 'move');
dbms_output.put_line('COMPLETED TIME: ' || to_char(sysdate, 'HH24:MI:SS'));
Or you could display the time from the shell instead, within the parentheses; that would also then go into the same log file.
You haven't shown a username or password in your SQL*Plus calls; you probably just hid them, but if you are connecting as SYS via /, you really shouldn't be creating objects in that schema. Create a new schema and work in that.

How to import an Oracle database from dmp file and log file?

How would I go about creating a database from a dump file? I do not have an existing database with the same structure on my system so it has to be complete with jobs, events, tables, and so on.
I placed the dump and log file in E: drive
I have tried the import utility
E:/>impdp system/tiger#oratest FILE=WB_PROD_FULL_20MAY11.dmp
But I'm getting error as
invalid argument value
bad dump file specification
unable to open dump file "E:\app\admin\oratest\dpdump\WB_PROD_F
ULL_20MAY11.dmp" for read
unable to open file
unable to open file
(OS 2) The system cannot find the file specified.
And when I see in Windows Explorer DMP file(taken from Linux server) is showing as Crash dump file
I don't understand how I can resolve this issue. Please help me to solve this issue.
I'm a complete newbie on Oracle...
How was the database exported?
If it was exported using exp and a full schema was exported, then
Create the user:
create user <username> identified by <password> default tablespace <tablespacename> quota unlimited on <tablespacename>;
Grant the rights:
grant connect, create session, imp_full_database to <username>;
Start the import with imp:
imp <username>/<password>#<hostname> file=<filename>.dmp log=<filename>.log full=y;
If it was exported using expdp, then start the import with impdp:
impdp <username>/<password> directory=<directoryname> dumpfile=<filename>.dmp logfile=<filename>.log full=y;
Looking at the error log, it seems you have not specified the directory, so Oracle tries to find the dmp file in the default directory (i.e., E:\app\Vensi\admin\oratest\dpdump\).
Either move the export file to the above path or create a directory object to pointing to the path where the dmp file is present and pass the object name to the impdp command above.
All this peace of code put into *.bat file and run all at once:
My code for creating user in oracle. crate_drop_user.sql file
drop user "USER" cascade;
DROP TABLESPACE "USER";
CREATE TABLESPACE USER DATAFILE 'D:\ORA_DATA\ORA10\USER.ORA' SIZE 10M REUSE
AUTOEXTEND
ON NEXT 5M EXTENT MANAGEMENT LOCAL
SEGMENT SPACE MANAGEMENT AUTO
/
CREATE TEMPORARY TABLESPACE "USER_TEMP" TEMPFILE
'D:\ORA_DATA\ORA10\USER_TEMP.ORA' SIZE 10M REUSE AUTOEXTEND
ON NEXT 5M EXTENT MANAGEMENT LOCAL
UNIFORM SIZE 1M
/
CREATE USER "USER" PROFILE "DEFAULT"
IDENTIFIED BY "user_password" DEFAULT TABLESPACE "USER"
TEMPORARY TABLESPACE "USER_TEMP"
/
alter user USER quota unlimited on "USER";
GRANT CREATE PROCEDURE TO "USER";
GRANT CREATE PUBLIC SYNONYM TO "USER";
GRANT CREATE SEQUENCE TO "USER";
GRANT CREATE SNAPSHOT TO "USER";
GRANT CREATE SYNONYM TO "USER";
GRANT CREATE TABLE TO "USER";
GRANT CREATE TRIGGER TO "USER";
GRANT CREATE VIEW TO "USER";
GRANT "CONNECT" TO "USER";
GRANT SELECT ANY DICTIONARY to "USER";
GRANT CREATE TYPE TO "USER";
create file import.bat and put this lines in it:
SQLPLUS SYSTEM/systempassword#ORA_alias #"crate_drop_user.SQL"
IMP SYSTEM/systempassword#ORA_alias FILE=user.DMP FROMUSER=user TOUSER=user GRANTS=Y log =user.log
Be carefull if you will import from one user to another. For example if you have user named user1 and you will import to user2 you may lost all grants , so you have to recreate it.
Good luck, Ivan
If you are using impdp command example from #sathyajith-bhat response:
impdp <username>/<password> directory=<directoryname> dumpfile=<filename>.dmp logfile=<filename>.log full=y;
you will need to use mandatory parameter directory and create and grant it as:
CREATE OR REPLACE DIRECTORY DMP_DIR AS 'c:\Users\USER\Downloads';
GRANT READ, WRITE ON DIRECTORY DMP_DIR TO {USER};
or use one of defined:
select * from DBA_DIRECTORIES;
My ORACLE Express 11g R2 has default named DATA_PUMP_DIR (located at {inst_dir}\app\oracle/admin/xe/dpdump/) you sill need to grant it for your user.

Howto import an oracle dump in an different tablespace

I want to import an oracle dump into a different tablespace.
I have a tablespace A used by User A. I've revoked DBA on this user and given him the grants connect and resource. Then I've dumped everything with the command
exp a/*** owner=a file=oracledump.DMP log=log.log compress=y
Now I want to import the dump into the tablespace B used by User B. So I've given him the grants on connect and resource (no DBA). Then I've executed the following import:
imp b/*** file=oracledump.DMP log=import.log fromuser=a touser=b
The result is a log with lots of errors:
IMP-00017: following statement failed with ORACLE error 20001: "BEGIN DBMS_STATS.SET_TABLE_STATS
IMP-00003: ORACLE error 20001 encountered
ORA-20001: Invalid or inconsistent input values
After that, I've tried the same import command but with the option statistics=none. This resulted in the following errors:
ORA-00959: tablespace 'A_TBLSPACE' does not exist
How should this be done?
Note: a lot of columns are of type CLOB. It looks like the problems have something to do with that.
Note2: The oracle versions are a mixture of 9.2, 10.1, and 10.1 XE. But I don't think it has to do with versions.
You've got a couple of issues here.
Firstly, the different versions of Oracle you're using is the reason for the table statistics error - I had the same issue when some of our Oracle 10g Databases got upgraded to Release 2, and some were still on Release 1 and I was swapping .DMP files between them.
The solution that worked for me was to use the same version of exp and imp tools to do the exporting and importing on the different Database instances. This was easiest to do by using the same PC (or Oracle Server) to issue all of the exporting and importing commands.
Secondly, I suspect you're getting the ORA-00959: tablespace 'A_TBLSPACE' does not exist because you're trying to import a .DMP file from a full-blown Oracle Database into the 10g Express Edition (XE) Database, which, by default, creates a single, predefined tablespace called USERS for you.
If that's the case, then you'll need to do the following..
With your .DMP file, create a SQL file containing the structure (Tables):
imp <xe_username>/<password>#XE file=<filename.dmp> indexfile=index.sql full=y
Open the indexfile (index.sql) in a text editor that can do find and replace over an entire file, and issue the following find and replace statements IN ORDER (ignore the single quotes.. '):
Find: 'REM<space>' Replace: <nothing>
Find: '"<source_tablespace>"' Replace: '"USERS"'
Find: '...' Replace: 'REM ...'
Find: 'CONNECT' Replace: 'REM CONNECT'
Save the indexfile, then run it against your Oracle Express Edition account (I find it's best to create a new, blank XE user account - or drop and recreate if I'm refreshing):
sqlplus <xe_username>/<password>#XE #index.sql
Finally run the same .DMP file you created the indexfile with against the same account to import the data, stored procedures, views etc:
imp <xe_username>/<password>#XE file=<filename.dmp> fromuser=<original_username> touser=<xe_username> ignore=y
You may get pages of Oracle errors when trying to create certain objects such as Database Jobs as Oracle will try to use the same Database Identifier, which will most likely fail as you're on a different Database.
If you're using Oracle 10g and datapump, you can use the REMAP_TABLESPACE clause. example:
REMAP_TABLESPACE=A_TBLSPACE:NEW_TABLESPACE_GOES_HERE
For me this work ok (Oracle Database 10g Express Edition Release 10.2.0.1.0):
impdp B/B full=Y dumpfile=DUMP.dmp REMAP_TABLESPACE=OLD_TABLESPACE:USERS
But for new restore you need new tablespace
P.S. Maybe useful http://www.oracle-base.com/articles/10g/OracleDataPump10g.php
What version of Oracle are you using? If its 10g or greater, you should look at using Data Pump instead of import/export anyway. I'm not 100% sure if it can handle this scenario, but I would expect it could.
Data Pump is the replacement for exp/imp for 10g and above. It works very similar to exp/imp, except its (supposedly, I don't use it since I'm stuck in 9i land) better.
Here is the Data Pump docs
The problem has to do with the CLOB columns. It seems that the imp tool cannot rewrite the create statement to use another tablespace.
Source: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:66890284723848
The solution is:
Create the schema by hand in the correct tablespace. If you do not have a script to create the schema, you can create it by using the indexfile= of the imp tool.
You do have to disable all constraints your self, the oracle imp tool will not disable them.
After that you can import the data with the following command:
imp b/*** file=oracledump.dmp log=import.log fromuser=a touser=b statistics=none ignore=y
Note: I still needed the statistics=none due to other errors.
extra info about the data pump
As of Oracle 10 the import/export is improved: the data pump tool ([http://www.oracle-base.com/articles/10g/OracleDataPump10g.php][1])
Using this to re-import the data into a new tablespace:
First create a directory for the temporary dump:
CREATE OR REPLACE DIRECTORY tempdump AS '/temp/tempdump/';
GRANT READ, WRITE ON DIRECTORY tempdump TO a;
Export:
expdp a/* schemas=a directory=tempdump dumpfile=adump.dmp logfile=adump.log
Import:
impdp b/* directory=tempdump dumpfile=adump.dmp logfile=bdump.log REMAP_SCHEMA=a:b
Note: the dump files are stored and read from the server disk, not from the local (client) disk
my solution is to use GSAR utility to replace tablespace name in the DUMP file. When you do replce, make sure that the size of the dump file unchanged by adding spaces.
E.g.
gsar -f -s"TSDAT_OV101" -r"USERS " rm_schema.dump rm_schema.n.dump
gsar -f -s"TABLESPACE """USERS """ ENABLE STORAGE IN ROW CHUNK 8192 RETENTION" -r" " rm_schema.n1.dump rm_schema.n.dump
gsar -f -s"TABLESPACE """USERS """ LOGGING" -r" " rm_schema.n1.dump rm_schema.n.dump
gsar -f -s"TABLESPACE """USERS """ " -r" " rm_schema.n.dump rm_schema.n1.dump
I wanna improve for two users both in different tablespaces on different servers (databases)
1.
First create a directories for the temporary dump for both servers (databases):
server #1:
CREATE OR REPLACE DIRECTORY tempdump AS '/temp/old_datapump/';
GRANT READ, WRITE ON DIRECTORY tempdump TO old_user;
server #2:
CREATE OR REPLACE DIRECTORY tempdump AS '/temp/new_datapump/';
GRANT READ, WRITE ON DIRECTORY tempdump TO new_user;
2.
Export (server #1):
expdp tables=old_user.table directory=tempdump dumpfile=adump.dmp logfile=adump.log
3.
Import (server #2):
impdp directory=tempdump dumpfile=adump_table.dmp logfile=bdump_table.log
REMAP_TABLESPACE=old_tablespace:new_tablespace REMAP_SCHEMA=old_user:new_user
The answer is difficult, but doable:
Situation is: user A and tablespace X
import your dump file into a different database (this is only necessary if you need to keep a copy of the original one)
rename tablespace
alter tablespace X rename to Y
create a directory for the expdp command en grant rights
create a dump with expdp
remove the old user and old tablespace (Y)
create the new tablespace (Y)
create the new user (with a new name) - in this case B - and grant rights (also to the directory created with step 3)
import the dump with impdp
impdp B/B directory=DIR dumpfile=DUMPFILE.dmp logfile=LOGFILE.log REMAP_SCHEMA=A:B
and that's it...
Because I wanted to import (to Oracle 12.1|2) a dump that was exported from a local development database (18c xe), and I knew that all my target databases will have an accessible tablespace called DATABASE_TABLESPACE, I just created my schema/user to use a new tablespace of that name instead of the default USERS (to which I have no access on the target databases):
-- don't care about the details
CREATE TABLESPACE DATABASE_TABLESPACE
DATAFILE 'DATABASE_TABLESPACE.dat'
SIZE 10M
REUSE
AUTOEXTEND ON NEXT 10M MAXSIZE 200M;
ALTER DATABASE DEFAULT TABLESPACE DATABASE_TABLESPACE;
CREATE USER username
IDENTIFIED BY userpassword
CONTAINER=all;
GRANT create session TO username;
GRANT create table TO username;
GRANT create view TO username;
GRANT create any trigger TO username;
GRANT create any procedure TO username;
GRANT create sequence TO username;
GRANT create synonym TO username;
GRANT create synonym TO username;
GRANT UNLIMITED TABLESPACE TO username;
An exp created from this makes imp happy on my target.
---Create new tablespace:
CREATE TABLESPACE TABLESPACENAME DATAFILE
'D:\ORACL\ORADATA\XE\TABLESPACEFILENAME.DBF' SIZE 350M AUTOEXTEND ON NEXT 2500M MAXSIZE UNLIMITED
LOGGING
PERMANENT
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT MANUAL
FLASHBACK ON;
---and then import with below command
CREATE USER BVUSER IDENTIFIED BY VALUES 'bvuser' DEFAULT TABLESPACE TABLESPACENAME
-- where D:\ORACL is path of oracle installation

Resources