Oracle12c的相关命令及操作

[oracle@pacollector ~]$ lsnrctl status
[oracle@pacollector ~]$ lsnrctl start
[oracle@pacollector ~]$ lsnrctl stop

[oracle@pacollector ~]$ sqlplus /nolog
SQL> conn /as sysdba
SQL> startup                                                --"启动数据库实例"
SQL> shutdown immediate                                     --"关闭数据库实例"
或者
[oracle@pacollector ~]$ sqlplus / as sysdba
SQL> startup                                                --"启动数据库实例"
SQL> shutdown immediate                                     --"关闭数据库实例"



sqlplus  username/password as sysdba


select * from v$version;
select userenv('language') from dual;



select * from dba_data_files;



create tablespace pa_middleware_data logging datafile '/u01/app/oracle/oradata/paoracle/quest_middleware_data.dbf' size 2049M autoextend on next 101m maxsize 20480m extent management local;

create tablespace pa_middleware_index logging datafile '/u01/app/oracle/oradata/paoracle/quest_middleware_index.dbf' size 2049m autoextend on next 101m maxsize 20480m extent management local;


create tablespace pa_collector_data logging datafile '/u01/app/oracle/oradata/pacollorcl/quest_collector_data.dbf' size 2049M autoextend on next 101m maxsize 20480m extent management local;

create tablespace pa_collector_index logging datafile '/u01/app/oracle/oradata/pacollorcl/quest_collector_index.dbf' size 2049m autoextend on next 101m maxsize 20480m extent management local;


drop tablespace pa_collector_data including contents and datafiles cascade constraints;
drop tablespace pa_collector_index including contents and datafiles cascade constraints;
alter database datafile '/ora/oradata/radius/undo.dbf' resize 10240m;


http://www.cnblogs.com/siyunianhua/p/4004361.html?utm_source=tuicool&utm_medium=referral
create user c##quest identified by quest;
grant connect,resource,dba to c##quest;
select username from dba_users where username='C##QUEST';
或者
select * from v$version;
select name,cdb from v$database;
select sys_context('USERENV', 'CON_NAME') from dual;
show con_name;
select pdb_id,pdb_name,dbid,status,creation_scn from dba_pdbs;
select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
alter pluggable database PDBCOLLORCL open;
select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
alter session set container=PDBCOLLORCL;
select sys_context('USERENV', 'CON_NAME') from dual;
show con_name;
create user quest identified by quest;
grant connect,resource,dba to quest;
commit;
select username from dba_users where username='QUEST';

select instance_name from v$instance;

sqlplus username/password@net_service_name    如:sqlplus username/password@pacollorcl
sqlplus username/password@pdb_name    如:sqlplus username/password@pacollorcl


[oracle@pacollector /]$ cd /u01/app/oracle/product/12.1.0/dbhome_1/network/admin
[oracle@pacollector admin]$ vi listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = pacollector)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = pacollorcl)
      (ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
      (SID_NAME = pacollorcl)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = PDBCOLLORCL)
      (ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
      (SID_NAME = pacollorcl)
    )
  )

[oracle@pacollector admin]$ vi tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

PACOLLORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = pacollector)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pacollorcl)
    )
  )

PDBCOLLORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = pacollector)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PDBCOLLORCL)
    )
  )



[oracle@pacollector /]$ sqlplus quest@PDBCOLLORCL

你可能感兴趣的:(oracle,数据库,oracle12C)