首页 > 数据库 >Oracle 操作命令

Oracle 操作命令

时间:2023-11-16 12:12:42浏览次数:38  
标签:操作命令 grant create orms tablespace Oracle select hke

切换到数据库用户: su - oracle

登录数据库  :sqlplus / as sysdba 

查看实例PDB1 :show pdbs;

设置会话  :alter session set container=PDB1;

查看数据文件:select file_name from dba_data_files;

创建数据库空间  :create tablespace orms_TBS datafile '/dddddd' size 1G autoextend on next 100M maxsize unlimited extent management local AUTOALLOCATE SEGMENT space MANAGEMENT AUTO;

创建索引表空间:create tablespace orms_TBS_INDEX datafile '/dddddd' size 1G autoextend on next 100M maxsize unlimited extent management local AUTOALLOCATE SEGMENT space MANAGEMENT AUTO;

创建临时表空间:create temporary tablespace tmp_data tempfile '/dddddd' size 1G reuse autoextend on next 100M maxsize unlimited ;

创建用户:create user orms identified by orms123 account unlock; /// create user hke identified by hke defaulte tablespace HKE_TBS temporary tablespace temp;

赋予角色:grant connect,resource to orms

分配权限
grant create procedure to hke with admin option;
grant create sequence to hke ;
grant create session to hke;
grant create synonym to hke;
grant create table to hke;
grant create trigger to hke;
grant create type to hke;
grant create view to hke;
grant unlimited tablespace to hke;
grant create job to hke;

grant select on V_$SQLAREA to hke;
grant select on V_$SESSION to hke;
grant select on V_$LOCKED_OBJECT to hke;
grant select on V_$PARAMETER to hke;
grant select on V_$PROCESS to hke;
grant select on V_$RECOVERY_FILE_DEST to hke;
grant select on DBA_FREE_SPACE to hke;
grant select on DBA_DATA_FILES to hke ;

创建逻辑目录:create or replace directory dp_dir as '/oradata'

赋予权限:grant read,write on directory dp_dir to ORMS;

 

修改库名 :ALTER DATABASE RENAME GLOBAL_NAME TO new_db_name;

修改原字段名: ALTER TABLE 表名 RENAME COLUMN 字段名 TO 字段名1;

添加一个字段:ALTER TABLE 表名 ADD 字段名 VARCHAR2(30);

查询当前登录用户下的所有表的名称  :SELECT TABLE_NAME FROM USER_TABLES;

 

 

删除用户: drop user orms cascade 

删除tablespace : DROP TABLESPACE tablespace_name INCLUDING CONTENTS AND DATAFILES

查询所有用户:select * from all_users;   select * from dba_users;

 

 


导出:expdp orms_uat/[email protected]:1521/pdb1 directory=DP_DIR dumpfile=orms_uat20231111.dmp logfile=orms_uat20231111.log SCHEMAS=orms_uat parallel=4 version=19.3.0.0;

 导入:impdp orms_uat/[email protected]:1521/pdb1 directory=DP_DIR dumpfile=orms_uat20231111.dmp logfile=orms_uat20231111.log SCHEMAS=orms_uat parallel=4 version=19.3.0.0;

标签:操作命令,grant,create,orms,tablespace,Oracle,select,hke
From: https://www.cnblogs.com/KL2016/p/17835894.html

相关文章

  • oracle DES3 to Java code
    oracle加密createorreplacefunctiondes3_enc(inputvarchar2)returnvarchar2isi_datavarchar2(128);v_invarchar2(255);i_keyvarchar2(128);raw_inputRAW(128);key_inputRAW(128);decrypted_rawRAW(2048);i_data:=input;raw_input:=UTL_RAW.CAST_T......
  • oracle SQL 实现对数据库的的脱敏和对称加密
    之前的kettleETL太慢了insertintoselect83w数据220skettle83w数据etl3h26w~功能变更耗时另外如果需要再次对其他字段做脱敏时间又比较耗时需要再次编写环节复制表INSERTINTOXXXXSELECT*FROMXXXX_JM;验证数据--源表总数SELECTCOUNT(*)F......
  • Python连接Oracle
    报错信息: Traceback(mostrecentcalllast):cx_Oracle.DatabaseError:DPI-1047:Cannotlocatea64-bitOracleClientlibrary:"libclntsh.so:cannotopensharedobjectfile:Nosuchfileordirectory".Seehttps://cx-oracle.readthedocs.io/en/latest/......
  • Oracle多租户系列--多租户简要概述
    简要概述Oracle12cRelease1(12.1)引入了多租户选项,是Oracle数据库历史上最大的架构变化之一,引入了容器数据库(CDB)和可插拔数据库(PDB)的概念。容器数据库(CDB):从表面上看,它与传统的Oracle数据库非常相似,因为它包含了大部分您已经熟悉的工作部分(控制文件、数据文件、undo、te......
  • Kettle 下载安装及连接Oracle
    1.Kettle下载安装官网地址:https://sourceforge.net/projects/pentaho/ 下载后解压,双击data-integration,找到spoon.bat进行双击,稍等几秒就可以显示界面 2.Oracle数据库连接 下载oracle的jar包,放至lib目录下 新建转换,DB连接如果没有jar包会报错 ......
  • oracle-触发器
    创建触发器的语法:create[orreplace]triggertri_name [before|after|insteadof]tri_event     ontable_name|view_name|user_name|db_name     [referencing[:old][:new]]     [foreachrow[whentri_condition]]begi......
  • oracle创建用户授权提示无权限解决方案
    流程如下:1.win+r输入cmd回车,打开命令行窗口,输入 sqlplus 用户名/密码assysdba以管理员身份连接数据库。    如:sqlplusscott/123456assysdba;2.创建用户并授权--创建用户createuser用户名identifiedby密码;--授予所有权限grantallprivilegesto......
  • 利用 kettle 对 oracle 实现字符串的脱敏和对称加密
    脱敏要求对身份证进行ASE加密处理对手机号只显示前三位和后四位其余使用****代替对于职业只显示前三个字对于真实姓名只显示展示一位即可kettle建立转换表输入表输出ASE加密选择组件密钥转换密钥必须是16进制且大于16个字节配置字段和加密算法......
  • oracle 查看SQL执行计划
    参考:https://blog.csdn.net/m0_71406734/article/details/130745657执行计划的目的了解SQL语句的执行方式,帮助开发人员和DBA分析SQL语句的性能瓶颈。查看SQL语句的执行效率,帮助开发人员和DBA优化SQL语句的性能。了解数据库的物理结构,如索引、表之间的连接方式等。帮助开发人......
  • oracle中insert用select方式插入慢的解决之一
    原理我没明白,但是可以解决插入过慢的问题。原SQLINSERT INTO LOGINSTATBYDEPTzsy(group_id, persons, loginTimes, loginPersons, datadate, TYPE)SELECT tg.id, p.persons, sum(lb.LOGINAMOUNT)sum1, count(DISTINCTtu.id)sum2, 1, 2FROM userdaylogini......