Search code examples
databaseoracle-databaseamazon-web-servicesamazon-rdssqlplus

How to connect to multiple Schema in Oracle RDS


I am creating a CI/CD pipeline to run my application, In my application it has multiple databases like database1, database2 ..... previously I was using AWS aurora Postgres , now I want to check the compatibility of the application with oracle RDS. Well, I don't know much about the oracle. I got to know that we can create multiple schemas

My application has 7 databases with a different names and in CI/CD pipeline I am using SQL plus to connect to the database and created all schemas, but I don't know how can I connect to a particular schema

I was able to connect to a database that I specified when creating Orcale RDS using:-

sqlplus  username/password@oracle.xxxxxx.us-east-1.rds.amazonaws.com:1521/demo

I have used the following command to create the schema:-

CREATE BIGFILE TABLESPACE  database1 DATAFILE SIZE 128M AUTOEXTEND ON NEXT 1M 
MAXSIZE unlimited LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

create user  database1 identified by database1 profile default default tablespace 
database1 TEMPORARY TABLESPACE TEMP ACCOUNT UNLOCK;

GRANT create trigger, CONNECT, RESOURCE, create table, create view, create 
procedure, create sequence TO  database1;

after that, I am running SQL plus command to connect to database1and it is not working

sqlplus  username/password@oracle.xxxxxx.us-east-1.rds.amazonaws.com:1521/database1

Just wanted to is there any way to connect to a particular schema as my application is using jdbc:oracle:thin to connect to the database


Solution

  • In Oracle, schema = user ("create user database1 ..."), so what you're looking for is this:

    sqlplus database1/database1@oracle.xxxxxx.us-east-1.rds.amazonaws.com:1521/demo
    

    'demo' is actually the network service name, which will be the same for all users/schemas within the physical database instance.