Flyway Migrations with Oracle 12c - oracle

I'm looking to get Flyway migrations setup with Oracle 12C, however running the 'flyway baseline' I received the following error on schema_table creation.
Message : ORA-01950: no privileges on tablespace 'USERS'
The end-goal here with this setup is to get a CI and CD process that can create an Oracle Database (with DBCA) then run flyway migrate to migrate the database to the latest version.
With that in mind, how can I get passed this issue? Do i need to create the scheme and Tablespace configuration outside of Flyway before I do anything?.
Edit: Moudiz has suggested ALTER USER quota 100M on USERS, whilst that does get me passed the issue. I'd be more interested in a solution in the area of dbca/flyway configuration. Any extra 'tweak' script i need to run for deployment is not ideal.

this statement should help you.
ALTER USER <user> quota 100M on USERS

Related

Is it possible to customize default tablespaces when installing Oracle Database 12c?

I'm having trouble with an Oracle Database 12c Release 1 install for Linux. I am expecting to see a 'DATA01' tablespace and 'INDEX01' tablespace after I finish installation and database setup.
I follow the guide at this link https://oracle-base.com/articles/12c/oracle-db-12cr1-installation-on-oracle-linux-7. After the install I end up with the following default tablespaces: SYSTEM , SYSAUX , USERS , UNDOTBS1 , and TEMP.
Am I missing some customization steps to get the 'DATA01' and 'INDEX01' tablespaces to show up or should I not expect those additional tablespaces?
I am expecting to see a 'DATA01' tablespace and 'INDEX01' tablespace after I finish installation and database setup.
Why are you expecting that? Default installation installs default tablespaces. If you want to take control over it, create the database yourself, starting with create database command.
It allows you to specify default (that would be your data01), temporary and undo tablespaces. Index (or any other) tablespace is added separately with create tablespace command. Nowadays, it is usual to let Oracle handle that itself. Previously, people did create separate tablespaces for data and indexes to improve performance, but today that's not to be done.
Finally, this question should probably be placed on SE DBA, not here (as we're mostly developers).

Oracle DBA, Unique situation with ORA-01017: invalid username/password; logon denied

I am facing a very unique situation here in Oracle DB.
I am facing "ORA-01017: invalid username/password; logon denied" error while logging in to my Oracle user using sqlplus.
Basic information about the system:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production.
2 database servers in cluster environment using Oracle clustering.
Please note that while using TOAD the user logs in perfectly however. The DB is accessible from toad using the connection details to login an individual db. It fails from TOAD while using the Cluster Scan-IP.
Following steps were performed before i started getting this issue.
I was getting a warning message from the Oracle for my user to change the password as it is expiring. Usually in situations like this i will reuse the same password however in this case it was not allowing me to reuse the same password. So I followed this link.
Now I am not able to login my user and I am even not able to completely change the password of my user and login.
Please advise with what went wrong.
Hi I am not sure exactly what your problem is, but these are the steps we follow to reuse a password:
get user profile
change profile to default
ALTER PROFILE "DEFAULT" LIMIT PASSWORD_REUSE_TIME UNLIMITED;
ALTER PROFILE "DEFAULT" LIMIT PASSWORD_REUSE_MAX UNLIMITED;
change password
ALTER PROFILE "DEFAULT" LIMIT PASSWORD_REUSE_TIME 120;
change profile back
Good luck!
The issue was caused because of special characters. I didn't imagine that "$" would be such a big deal in passwords. Anyway please find a work around for it here.

Create database in oracle for manually created user

I want to create the user and the database within that user. But when I tried to create database its giving the warning message as
ERROR at line 1:
ORA-01501: CREATE DATABASE failed
ORA-01100: database already mounted
Then I tried
STARTUP NOMOUNT;
Its giving the warning message for insufficient privileges even I have given all the permission to that particular user.
Can any one please help in finding the solution for this?
You don't create a database under a user in Oracle; I believe you're using terminology from another database poduct. The equivalent is a schema, which is a logical container for a group of objects. User and schema are essenentially synonymous in Oracle - when you create a user is automatically has its own schema.
You create the database once (which you already seem to have done, or had done for you), then create as many schemas/users as your application needs. You don't ever rerun the create database under normal circumstances - you certainly wouldn't as a normal user.
If you connect as that user you will be able to create tables, views, packages etc., assuming it has really been granted all the necessary privileges.

Issue creating a new user / schema in Oracle 11G instance

I have an Oracle instance with 8 users/schemas already but since late last week I am unable to create any new users on that instance. When I run the create user script it just keeps running....
This is a development box and I have full access to it. I am not a DBA so how do I troubleshoot to find out what the issue could be? and what could the issue be?
Here is the create user script:
create user usr_ARCHIVE identified by usr_ARCHIVEpw
default tablespace USERS
temporary tablespace TEMP
profile DEFAULT
quota UNLIMITED on USERS;
Please have a look at the user tablespace to see whether it has enough free space or not. I have faced similar issues in the past.
It's probably waiting or trying to obtain a lock. To determine what is going on you need to enable tracing. Before executing the create user statement, execute the following command:
alter session set events '10046 trace name context forever, level 12';
This will create a trace file in the trace directory. By default this is the same directory where the alert.log file is stored. Analyze the trace file and especially check for the lines that start with WAIT.
The problem was with another 10G TNSListener that was running. Once the 10G TNSListener was stopped and 11G Listener restarted the issue was resolved.

Oracle: Recover backup in other different than original server

I'm really newbie about Oracle backup operations. I'm really new in this world and I need to know how to backup a DB schema and restore it in another machine under another schema name.
I cannot afford any mistake since I'll be doing this in our customer site, an making a small mistake could be the last one
I don't want to sound offensive, but doing this in MySQL is really easy, like this:
in server one:
$mysqldump --user=user --password=password db_to_backup > bc_name.sql
-after transfering the sql script to another server
in server two:
mysql>create database db_to_restore;
$mysql --user=user --password=password db_to_restore < bc_name.sql
I need to do the same using Oracle, I read some documentation but I'm still unsure how to do it:
First: What's the equivalent of MySQL database in Oracle? tablespace?
Second: I think these are the steps to get a backup
mkdir /opt/oracle/dumptmp/
CREATE OR REPLACE DIRECTORY dumptmp AS '/opt/oracle/dumptmp/';
expdp user/pass#tablespace directory=dumptmp dumpfile=dumptmp:full.dmp logfile=dumptmp:full.log full=y
Third: Then I move the file "full.dmp" to the other server, but I'm not sure how to restore my backup file full.dmp into a new tablespace with a different name to the one it the backup was gotten from:
SQLPLUS>create tablespace ts_something;
then I'm not sure how to proceed from here. Please advice me how to do it using command line commands since my customer does not have GUI tools intalled.
Thanks a lot!
First of all, make sure you test this procedure in test or development environments before proceeding to perform it on production. Disclaimer: I'm not responsible if you bust any of your databases by misusing the following advice. Note that I'm also ignoring how tablespace storage is set up for your schemas, which you should definitely hold in consideration when creating new schemas.
Here is the simplest possible method using command line. You will need to use exp and imp utilities which come with complete Oracle database distributions. Assuming that you have the path to Oracle executables set correctly in your environment path, you will need to do:
Export your source schema on the source database server:
[oracle#src_server ~]$ exp source_schema_username#SRC_SID owner=source_schema_username file=source_schema.dmp
Import your source schema into destination schema on the destination database server (assuming you have already created the destination schema, if not, see CREATE USER, also make sure that destination schema user has RESOURCE role):
[oracle#dst_server ~]$ imp system#DST_SID fromuser=source_schema_username touser=destination_schema_username file=source_schema.dmp
Note that you must run imp as a user that has DBA role. I'm using system here because this user typically exists on all Oracle databases and has DBA role. You will of course need to know the password for system user. You may not need to specify SIDs if ORACLE_SID is already set in your environment on both servers (echo $ORACLE_SID), however I wanted to be explicit here to make sure that you do not import into the wrong database.
For more information on usage of export and import utilities run exp help=y and imp help=y.
To answer your questions about Oracle:
First: What's the equivalent of MySQL database in Oracle? tablespace?
Oracle equivalent is database name (db_name parameter). It identifies a database on Oracle database server(s). On a single instance database, this is also typically Oracle SID. On Oracle RAC, a single database will have many SIDs.
Third: Then I move the file "full.dmp" to the other server, but I'm not sure how to restore my backup file full.dmp into a new tablespace with a different name to the one it the backup was gotten from:
You want to create a new user, which is identical to a schema in Oracle. Tablespaces are abstracted collections of disk locations where Oracle stores tables and indicies. For example, when you create a table, it has to be assigned to some tablespace.
What you're explaining is not really a backup, more like schema export & import.
but doing this in MySQL is really easy.
So is doing the same in Oracle.
exp user/password#hoststring file=bc_name.dmp log=bc_name.log full=y statistics=none
& to import it,
imp new_user/new_password#hoststring file=bc_name.dmp log=bc_name.log full=y
If new_user doesn't exist then create the users
create user new_user identified by new_password
and grant the rights
grant create session,connect,imp_full_database to new_user

Resources