oracle基本操作

行云流水
2023-06-01 / 0 评论 / 56 阅读 / 正在检测是否收录...

前言

oracle启动之后,一些基本的管理命令。

归档日志位置

#创建目录
mkdir -p /data1/archive_log   

sqlplus  / as sysdba;

SQL> 
      alter system set db_recovery_file_dest='';
      ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 100G SCOPE=BOTH SID='*';
      alter system set log_archive_dest_1='location=/data1/archive_log' scope=both; 


      archive log list;

更改数据库字符集

sqlplus / as  sysdba
select userenv('language') from dual;
shutdown immediate;
startup mount;
alter system enable restricted session ;
alter system set job_queue_processes=0;
alter database open;
alter database character set internal_use UTF8;
shutdown immediate;
startup;

数据库管理

# 关闭数据库
# emctl stop dbconsole
# lsnrctl stop
$sqlplus  / as  sysdba;
SQL>  shutdown  immediate;
    
# 启动数据库
sqlplus / as sysdba
SQL> startup
      
# lsnrctl start
# emctl start dbconsole

建库授权

create user testoracledb identified by testoracledbHASADGd3426; 
create tablespace testoracledbts datafile '/opt/oracle/oradata/testoracledb01.dbf' size 30G;
grant connect,resource,unlimited tablespace to testoracledb;
alter user testoracledb default tablespace testoracledbts;

常用命令

#查看数据库用户列表
select  username  from   dba_users;

#查看某个用户权限
select   PRIVILEGE from DBA_SYS_PRIVS  where GRANTEE='CONNECT' or GRANTEE='RESOURCE' or GRANTEE='WANGXIAN252';

评论 (0)

取消
只有登录/注册用户才可评论