Create DB:
CREATE DATABASE Database_Name;
show DB:
SHOW DATABASE ;
replace or new DB:
CREATE OR REPLACE DATABASE Student ;
Drop DB:
DROP DATABASE Database_Name;
Rename DB:
ALTER DATABASE old_database_name MODIFY NAME = new_database_name;
Select DB:
use database_name;
====================================================================
- create database sample_db --------//create database
- drop database sample_db ----------------// drop database
- select name from v$database -------------//name of database = orcl
- select * from v$instance -------------- 1orcl PRABHU-NOTEBOOK 11.2.0.1.0
- select * from v$database ---------------------- // for all details about database
- select * from v$version -------------// version of oracle database
=====================================================================
Login as Administrator
SQLPLUS / AS SYSDBA
sys as sysdba ____ password
Create User:
create user c##prabhu identified by oracle2021;
Grant DBA access to user:
grant resource, connect to c##prabhu;
grant dba to c##prabhu;
Change user Password:
ALTER USER existing_account_name IDENTIFIED BY new_password ACCOUNT UNLOCK;
Command prompt align change:
set line 700;
set pagesize 400;
=====================================================================
CREATE USER manyam IDENTIFIED BY abcd1234;
GRANT DBA access to manyam;
GRANT CREATE SESSION TO manyam;
CREATE ROLE warehouse_staff;
CREATE ROLE warehouse_manager IDENTIFIED BY oracle;
GRANT warehouse_staff to warehouse_manager;
GRANT warehouse_manager TO manyam;
SET ROLE warehouse_manager IDENTIFIED BY oracle;
SELECT * FROM session_roles;
// ROLE
// ------------------------------
// WAREHOUSE_MANAGER
// WAREHOUSE_STAFF