oracle常用知识随笔
1、创建表空间及用户赋权
create tablespace spaceone
datafile '/dev/spaceone'
size 80m
extent management local
segment space management auto
/
extent management local
segment space management auto 用法:
(1)如果file 已经存在,并且在创建时指定了file size,那么就重用原文件,并应用新的size,如果没有指定file size,则保留原有的大小
(2)如果file 不存在,oracle 将忽略该参数
(3)如果Oracle 使用了已经存在的file,那么之前file里的数据将全部丢失
2、创建用户及赋权
set serveroutput on;
set feedback off;
set term off;
set linesize 200;
set define on;
clear screen;
declare
susername varchar2(100):=nvl('&1','report');
spassword varchar2(100):=nvl('&2','report');
v_count number;
i_l_9i number;
i_l_count integer;
i_l_countl integer;
str_l_key varchar2(300):='schema_name';
str_l_schema varchar2(300):=upper(susername);
i_l_count3 integer;
i_l_count4 integer;
begin
select count(1)
into v_count
from dba_users
where username=upper(susername)
if v_count > 0 then
execute immediate 'drop user'||susername||'cascade';
end if;
execute immediate 'create user'||susername||'identified by'||spassword||
'default tablespace ring'||
'temporary tablespace temp'||
'quota unlimited on ring'||
'quota unlimited on ringidx'||
execute immediate 'grant connect to'||susername;
execute immediate 'grant debug connect to'||susername;
execute immediate 'grant create trigger to'||susername;
execute immediate 'grant create table to'||susername;
execute immediate 'grant create view to'||susername;
execute immediate 'grant create procedure to'||susername;
execute immediate 'grant create database link to'||susername;
execute immediate 'grant execute on dbms_crypto to'||susername;
execute immediate 'grant synonym to'||susername;
execute immediate 'grant drop any synonym to'||susername;
execute immediate 'grant debug connect session to'||susername;
execute immediate 'grant execute on dbms_scheduler to'||susername;
execute immediate 'grant create job to'||susername;
execute immediate 'grant execute on dbms_job to'||susername;
execute immediate 'grant select_catalog_role to'||susername;
execute immediate 'grant create external job to'||susername;
execute immediate 'grant query rewrite to'||susername;
execute immediate 'grant select on v_$process to'||susername;
execute immediate 'grant select on v_$parameter to'||susername;
execute immediate 'grant execute on dbms_lock to'||susername;
execute immediate 'grant select on v_$lock to'||susername;
execute immediate 'grant select on v_$session_wait to'||susername;
execute immediate 'grant create session to'||susername;
execute immediate 'grant select on v_$mystat to'||susername;
execute immediate 'grant alter session to'||susername;
execute immediate 'grant alter system to'||susername;
execute immediate 'grant debug connect session to'||susername;
execute immediate 'grant create sequence to'||susername
execute immediate 'grant create type to'||susername;
execute immediate 'grant select on all_tab_partitions to'||susername;
execute immediate 'grant select on user_index to'||susername;
execute immediate 'grant select on user_tables to'||susername;
execute immediate 'grant create any directory to'||susername;
select count(*) into i_l_9i from v$version where banner like '%9.%';
select count(*) into i_l_count from user_tables t where t.table_name ='T_REPORT_SCHEMA';
if (i_l_9i=0) then
execute immediate 'grant select on v_$sga_dynamic_components to'||susername;
end if;
if (i_l_9i=0) then
execute immediate 'begin dbms_stats.delete_system_stats() end';
execute immediate 'begin dbms_stats.set_system_stats(upper(''CPUSPEEDNW''),1840) end'
end if;
if (i_l_count=0) then
execute immediate 'create table T_REPORT_SCHEMA(KEY varchar2(500) not null,
value varchar2(500) not null,
owner varchar2(500) default user not null)';
execute immediate 'insert into T_REPORT_SCHEMA(KEY,value,owner) values (''schema_name'',upper('||susername||'),upper('||susername||'))';
end if;
oracle常用知识随笔的更多相关文章
- Oracle常用知识小总结
永不放弃,一切皆有可能!!! 只为成功找方法,不为失败找借口! Oracle常用知识小总结 1. 创建自增主键 对于习惯了SQL SERVER的图形化界面操作的SQLer,很长一段时间不用oracle ...
- Oracle常用知识小结
前言: 前一段时间项目开发数据库环境为Oracle,作为一个SQLer,表示各种不适应.所以刚开始的时候走了一些弯路,浪费了一席时间.因此就想把这些常用的东西给总结一下,算是对自己学习的总结,也希望能 ...
- oracle 常用知识积累
一. 基本操作 1. 表操作 1.1 复制建表 create table test as select * from dept; --从已知表复制数据和结构 create table test a ...
- 【基于WPF+OneNote+Oracle的中文图片识别系统阶段总结】之篇一:WPF常用知识以及本项目设计总结
篇一:WPF常用知识以及本项目设计总结:http://www.cnblogs.com/baiboy/p/wpf.html 篇二:基于OneNote难点突破和批量识别:http://www.cnblog ...
- ORACLE数据库 DBA常用知识
<常用命令参考> 个系统变量值 SQL> show user --显示当前连接用户 SQL> show error --显示错误 SQL> set heading off ...
- Oracle 数据库知识汇总篇
Oracle 数据库知识汇总篇(更新中..) 1.安装部署篇 2.管理维护篇 3.数据迁移篇 4.故障处理篇 5.性能调优篇 6.SQL PL/SQL篇 7.考试认证篇 8.原理体系篇 9.架构设计篇 ...
- Oracle 基础知识入门
前记: 近来项目用到Oracle数据库,大学学了点,后面基本忘记得差不多了,虽然基本语法跟sql 差不多,但是oracle知识是非常多的. 这里简单说点基础知识,希望后面补上更多的关于ORacle知识 ...
- Oracle常用命令大全(很有用,做笔记)
一.ORACLE的启动和关闭 1.在单机环境下 要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下 su - oracle a.启动ORACLE系统 oracle>svrmgrl ...
- Oracle常用语法
Oracle常用语句语法汇总 Oracle10g 1 第一章Oracle命令 a) 系统管理员连接 conn */* as sysdba b) 查询当前用户 show user c) 创建新用户 cr ...
- Oracle常用函数
前一段时间学习Oracle 时做的学习笔记,整理了一下,下面是分享的Oracle常用函数的部分笔记,以后还会分享其他部分的笔记,请大家批评指正. 1.Oracle 数据库中的to_date()函数的使 ...
随机推荐
- 跨域出现:XMLHttpRequest cannot load错误
1.右击浏览器图标-->属性-->快捷方式-->目标栏添加--> --args --disable-web-security --user-data-dir 2.修改之后重新打 ...
- Linux 在miniconda和anaconda同时安装时,卸载miniconda
1. 找到miniconda目录,删除. rm -rf miniconda3/ 2. 编辑bashrc sudo vim .bashrc setup路径改回anaconda3的,注释掉"&g ...
- 一个小demo---递归计算子类下的某个值的总和
public function demo($frames) { foreach ($frames as $k => $frame) { $frames[$k]['allCount'] = $fr ...
- Telerik GridView ----Pdf
ExportToPDF exporter = new ExportToPDF(this.radGridView1); exporter.FileExtension = "pdf"; ...
- pip设置镜像
国内镜像网站 镜像站名 网址 阿里云开源镜像站 http://mirrors.aliyun.com/ 网易开源镜像站 http://mirrors.163.com/ 搜狐开源镜像 http://mir ...
- css悬浮动画
1.Grow-Shadow /* Grow-Shadow */ .hvr-grow-shadow { display: inline-block; vertical-align: middle; -w ...
- 【QT】创建动态链接库及使用
创建动态链接库 创建一个项目 选择library的C++库,下一步. 选择共享库,输入动态库的名字,选择创建路径,下一步 选择编译环境,下一步 选择QTCore模块,该模块提供核心的非图形用户接口功能 ...
- float高度塌陷和BFC
开启BFC方式: 1.设置浮动float(副作用比较大,不推荐) 2.将元素设置为行内块元素 display:inline-block:(不推荐) 3.将元素的overlfow设置为非visible的 ...
- python菜鸟学习: 12. 装饰器的中级用法
# -*- coding: utf-8 -*-username = "liyuzhoupan"password = "123"def author(wrappr ...
- Cygwin64静默安装办法
下载地址: http://www.cygwin.com/setup-x86_64.exe 静默安装办法: .\setup-x86_64.exe --no-shortcuts --root D:\\Cy ...