1

I'm new with Oracle DBA in my new office, and they gave me a development server that already have a lot SID database online in SuSe (I checked with lsnrctl status)

enter image description here

My questions are :

  1. How to check what SID instance that really live/online, because turns out when I checked again with ps ax|grep ora, only 3 of databases live/online?

enter image description here

  1. If only 3 SID databases that really online like in 1st question, how do I know where all the 3 SID the database file position that already live/online? what do I have to type to know it?

  2. I try to login sqlplus sys as sysdba when I checked with select name from v$database; I was logging in 1 SID database. Continuing from 2nd question, How do I logout from current SID database and then switch to other 2 SID database?

    (example in MongoDB, I type use tutorial to enter tutorial database and type use dbdevelopment to switch to database dbdevelopment)

2 Answers 2

0
  1. cat /etc/oratab

  2. As a DBA, you need to learn the Oracle Data Dictionary.

"One of the most important parts of an Oracle database is its data dictionary, which is a read-only set of tables that provides information about the database"

SQL>select name from v$datafile;
# set environment
. oraenv <<< SID1; 
# login as sys user (IPC)
sqlplus / as sysdba
# list datafiles
SQL>select name from v$datafile;
SQL>exit
# repeat for SID2 and SID3

Side note.

One Oracle Database System (SID) can serve multiple databases (schemas). It is expensive, in terms of resources, to have multiple systems running.

# create database 1
SQL>create user DB_OWNER_1 identified by 'pass';
SQL>create table db_owner_1.t (x char(1));
# create database 2
SQL>create user DB_OWNER_2 identified by 'pass';
SQL>create table db_owner_2.t (x char(1));


# login as 'app user A' who has privileges to manipulate tables (DML) in database 1.
sqlplus appuserA/pass@TNS_ALIAS_1 
SQL>alter session set current_schema = "DB_OWNER_1"
SQL>insert into t values ('x');

# login as 'app user B' who has privileges to manipulate tables (DML) in database 2.
sqlplus appuserB/pass@TNS_ALIAS_2 
SQL>alter session set current_schema = "DB_OWNER_2"
SQL>insert into t values ('x');

You now have two applications operating on two different databases served by the one and same Oracle Database System.

Best of luck!

5
  • I'm sorry, I still don"t understand about #3 answer. because now it's getting weirder. I'm running a putty session that login to 1 SID database, but in another putty session I was logging in to another SID database. what's happened with my problem now? Can I just choose whatever SID database I want to login? Like just type login to "sqlplus as sysdba to DBtesting" to connect to DBtesting SID AND just type login to "sqlplus as sysdba to DBtuorial" to to DBtutorial SID database Commented Mar 5, 2021 at 11:10
  • 1
    Oracle's terminology for things is different than other DBs like MongoDB or mysql. For Oracle, "database" means "instance": the running processes at the system level. What other DBs call "database" Oracle calls "schema" or "user". A server can support many instances (each with an SID) and an instance can in turn support many schemas/users. An SID identifies an instance, but is generally only used to connect on the localhost. An instance can also have many network services (each with a service name) to accept remote connections of different kinds. This is what lsnrctl status shows.
    – pmdba
    Commented Mar 5, 2021 at 12:55
  • @Bjarte Brandt - any use of the term 'database' that equates it to a 'schema' ("You now have two applications operating on two different databases served by the one and same Oracle Database System.") is dead wrong in the oracle world. In oracle "database" does NOT equate to "schema". A database can/will have multiple schemas. Using the terms interchangeably, or using "database" to denote either "database" or "schema" is just wrong, and will add to the confusion of the OP.
    – EdStevens
    Commented Mar 5, 2021 at 15:55
  • @EdStevens I think it is useful to 'look at' a 'schema' as a 'database' and use the term 'database' for a 'schema' even if it is in Oracle terms 'dead wrong' . As an Oracle DBA it is sometimes OK to take the developers perspective. I have demonstrated the database/schema/user concept in code and those willing to play around with it will understand how this works. Developers contact me all the time requesting 'a database' for their unique super-special app. They need of course their 'own database' . Sure, I grant them a schema and app-users. Commented Mar 5, 2021 at 17:07
  • okay, that's a new insight of me, because in my office right now (we still use Sybase SQL Anywhere), we use terminology that pmdba and EdStevens use. 1 server can have so many instances. and an instance/database can in turn support many schemas/users. Sometimes, developer have different request, full backup it means entire schemas of that 1 database or just export import just one schema (that has a lot tables in it) or 2 schemas more of 1 database. Commented Mar 6, 2021 at 2:39
0

First, let's square away some of your terminology. In the Oracle world, a "SID" is the collection of processes and memory structures that manages a "database". A "database" is the collection of files that contain the data. One SID manages exactly one database, but in RAC (Real Application Cluster) configuration, one database can be managed by multiple SIDs. Thus your constant use of the term "sid database" is at best a bit awkward. While the SID and the DATABASE are two separate entities, their close relation leads to the term 'database' to be commonly used a bit more generiacly to refer to both the SID and the database.

As previously pointed out, in the oracle world, the term 'database' refers to a different concept than it does in other rdbms systems, such as MS Sql Server, IBM DB2, Sybase, etc. When those systems refer to 'database', they are talking about what oracle refers to as a 'schema'. In oracle a 'schema' is the collection of objects owned by a database user account, and is a logical structure within a database. A database has many schemas.

1
  • I'm actually Sybase SQL Anywhere DBA. Maybe I got misunderstood, because I think SID is the actual Database Server Name that we usually use in Sybase. That's why at first I think SID Database is one entity. but about schema that you explained it above, it's actually same understanding with mine tho, schema' is the collection of objects owned by a database user account, and is a logical structure within a database. A database has many schemas. we used that same term Commented Mar 6, 2021 at 2:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.