cpu_test.sql
网上看到这样的一个脚本,觉得不错。Cpu_test.sqlSPOOL cputest.txt;set serveroutput on size 10000;drop table dbtest/create table dbtest(col1 number, col2 varchar2(100))storage ( initial 512k next 512k pctincrease 0 )pctfree 10pctused 40cache/declare var_row varchar2(100); var_ctr integer; var_ins integer;begin for var_ctr in 1..10 loop var_row := var_row||'1234567890'; end loop; for var_ins in 1..2000 loop insert into dbtest values(var_ins,var_row); end loop;end;/commit;COLUMN s
show_space(摘)
create or replace procedure show_space ( p_segname_1 in varchar2, p_space in varchar2 default 'MANUAL', p_type_1 in varchar2 default 'TABLE' , p_analyzed in varchar2 default 'N', p_owner_1 in varchar2 default user) as p_segname varchar2(100); p_type varchar2(10); p_owner varchar2(30); l_unformatted_blocks number; l_unformatted_bytes number; l_fs1_blocks number; l_fs1_bytes number; l_fs2_blocks number; l_fs2_bytes number; l_fs3_blocks number; l_fs3_bytes number; l_fs4_blocks number; l_fs4_bytes n
oracle日期用法
TO_DATE格式 Day: dd number 12 dy abbreviated fri day spelled out friday ddspth spelled out, ordinal twelfth Month: mm number 03 mon abbreviated mar month spelled out march Year: yy two digits 98 yyyy four digits 1998 [@more@]TO_DATE格式 Day: dd number 12 dy abbreviated fri day spelled out friday ddspth spelled out, ordinal twelfth Month: mm number 03 mon abbreviated mar month spelled out march Year: yy two digits 98 yyyy four digits 1998 24小时格式下时间范围为: 0:00:00 - 23:59:59.... 12小时格式
系统状态查看工具Sysstat
1、关于 Sysstat;Sysstat 是一个软件包,包含监测系统性能及效率的一组工具,这些工具对于我们收集系统性能数据,比如CPU使用率、硬盘和网络吞吐数据,这些数据的收集和分析,有利于我们判断系统是否正常运行,是提高系统运行效率、安全运行服务器的得力助手;Sysstat 软件包集成如下工具:* iostat 工具提供CPU使用率及硬盘吞吐效率的数据;* mpstat 工具提供单个处理器或多个处理器相关数据;* sar 工具负责收集、报告并存储系统活跃的信息;* sa1 工具负责收集并存储每天系统动态信息到一个二进制的文件中。它是通过计划任务工具cron来
ORACLE 常用的SQL语法和数据对象
一.数据控制语句 (DML) 部分1.INSERT (往数据表里插入记录的语句)INSERT INTO 表名(字段名1, 字段名2, ……) VALUES ( 值1, 值2, ……); INSERT INTO 表名(字段名1, 字段名2, ……) SELECT 字段名1, 字段名2, …… FROM 另外的表名;字符串类型的字段值必须用单引号括起来, 例如: ’GOOD DAY’如果字段值里包含单引号’ 需要进行字符串转换, 我们把它替换成两个单引号''. 字符串类型的字段值超过定义的长度会出错, 最好在插入前进行长度校验.日期字段的字段值可以用当前数据库的系统时间SYSDATE, 精确到秒或者用字符串转换成日期型函数TO
set verify and set define
set verify [SQL*PluS]set verify on set verify off If verify is on, SQL*Plus prints two lines for each substituted variable (see set define). Storing settings across sessions[@more@]set verify [SQL*PluS]set verify on set verify off If verify is on, SQL*Plus prints two lines for each substituted variable (see set define). Storing settings across sessionsSettings (such as verify) can be stored accross sessions with the glogin.sql and/or login.sql file. set define [SQL*Plus]set define on set de
一些常用的计划脚本(1)
############################################################ getcode.sql --获得某个存储过程、包、函数代码脚本 set feedback off set heading off set termout off set linesize 1000 set trimspool on set verify off spool &1..sql prompt set define off select decode( type||'-'||to_char(line,'fm99999'), 'PACKAGE BODY-1', '/'||chr(10), null) || decode(line,1,'create or replace ', '' ) || text text from user_source where name = upper('&&1') ord
oracle的nvl函数的用法
oracle的nvl函数的用法通过查询获得某个字段的合计值,如果这个值位null将给出一个预设的默认值select nvl(sum(t.dwxhl),1) from tb_jhde t where zydm=-1这里关心的nvl的用法,nvl(arg,value)代表如果前面的arg的值为null那么返回的值为后面的value另一个有关的有用方法declare i integerselect nvl(sum(t.dwxhl),1) into i from tb_jhde t where zydm=-1这样就可以把获得的合计值存储到变量i中,如果查询的值为null就把它的值设置为默认的1[@more@]oracle的nvl函数的用法通过查询获得某个字段的合计值,如果这个值位null将给出一个预设
SQL Union和SQL Union All用法
UNION 指令的目的是将两个 SQL 语句的结果合并起来。从这个角度来看, UNION 跟 JOIN 有些许类似,因为这两个指令都可以由多个表格中撷取资料。 UNION 的一个限制是两个 SQL 语句所产生的栏位需要是同样的资料种类。另外,当我们用 UNION这个指令时,我们只会看到不同的资料值 (类似 SELECT DISTINCT)。 union只是将两个结果联结起来一起显示,并不是联结两个表………… UNION 的语法如下: [SQL 语句 1]UNION[@more@]SQL Union和SQL Union All用法作者: ckernel 发布日期: 2006-10-19 查看数: 546 出自: http://www.linuxdiyf.co
SQL中的单记录函数
1.ASCII返回与指定的字符对应的十进制数;SQL> select ascii('A') A,ascii('a') a,ascii('0') zero,ascii(' ') space from dual; A A ZERO SPACE--------- --------- --------- --------- 65 97 48 322.CHR给出整数,返回对应的字符;SQL> select chr(54740) zhao,chr(65) chr65 from dual;ZH C-- -赵 A3.CONCAT连接两个字符串;SQL> select concat('010-','88888888')||'转23' 高乾竞电话 from dual;高乾竞电话----------------010-88888888转234.INITCAP返回字符串并将字符串
Oracle/PLSQL: Lpad Function
Oracle/PLSQL: Lpad FunctionIn Oracle/PLSQL, the lpad function pads the left-side of a string with a specific set of characters.The syntax for the lpad function is:lpad( string1, padded_length, [ pad_string ] )string1 is the string to pad characters to (the left-hand side).padded_length is the number of characters to return. If the padded_length is smaller than the original string, the lpad function will truncate the string to the size of padded_length.pad_string is optional. This is the string t
a poem
To see a worldIn a grain of sandand a heaven in a wild flowerHold infinity in the palm of your handand eternity in an hour一粒沙里有一个世界,一朵花有一个天堂。把无穷无尽握于手掌,永恒宁非是刹那时光?[@more@]To see a worldIn a grain of sandand a heaven in a wild flowerHold infinity in the palm of your handand eternity in an hour一粒沙里有一个世界,一朵花有一个天堂。把无穷无尽握于手掌,永恒宁非是刹那时光?
听杨振宁讲奥本海默的一段话有感
在听杨振宁讲的物理与美的时候,他讲了德国大物理学家奥本海默关于回忆他是怎么向量子力学迈的一大步的。奥本海默喜欢爬山,他就用爬山来做比喻了。[@more@]在听杨振宁讲的物理与美的时候,他讲了德国大物理学家奥本海默关于回忆他是怎么向量子力学迈的一大步的。奥本海默喜欢爬山,他就用爬山来做比喻了。当你爬某座大山的时候,你常常会发觉大山的山顶会满是云雾,虽然你有地图或是索引之类的东西,但是你还是无法确定你到底是在哪里。但是有时候也就是那么一瞬间,或是几秒钟的样子,你会在去雾中发现一块大石头,哦,那就是我要找的大
富士山下
富士山下(粤)作曲:christopher chak(泽日生)填词:林夕编曲:陈珀 c.y. kong监制:alvin leong陈奕迅-富士山下(粤)拦路雨偏似雪花饮泣的你冻吗这风褛我给你磨到有襟花连调了职也不怕怎么始终牵挂苦心选中今天想车你回家原谅我不再送花伤口应要结疤花瓣铺满心里坟场才害怕如若你非我不嫁彼此终必火化一生一世等一天需要代价谁都只得那双手靠拥抱亦难任你拥有要拥有必先懂失去怎接受曾沿着雪路浪游为何为好事泪流谁能凭爱意要富士山私有何不把悲哀感觉假设是来自你虚构试管里找不到它染污眼眸前尘硬化像石头随缘地抛下便逃走我绝不罕有往街里绕
乾道成男,坤道成女
这两句话,后来发展到道家的阐释男性女性时说:男人一身都是阴性,只有一点真阳;而女人一身都是阳性,只有一点真阴。这就是说阳中有阴,阴中有阳。一个男人,身材威武,脾气很大,所谓气宇轩昂,往往有女性的情感及态度;反之,看来很温柔的女性,而往往心理状态则是男性化。心理学上的例子很多的,比如古代的“青竹蛇儿口,黄蜂尾上针,两般皆不毒,最毒妇人心”。但是深一层观察很有道理。女性的性情本来温柔,但下了决心了的时候,果断的力量比男性大,而男人个性非常激烈的,真到了某一个阶段时,反会犹豫不决。女性也往往比男性聪明
Oracle常用函数列表速查
PL/SQL单行函数和组函数详解 函数是一种有零个或多个参数并且有一个返回值的程序。在SQL中Oracle内建了一系列函数,这些函数都可被称为SQL或PL/SQL语句,函数主要分为两大类: 单行函数 组函数[@more@]PL/SQL单行函数和组函数详解 函数是一种有零个或多个参数并且有一个返回值的程序。在SQL中Oracle内建了一系列函数,这些函数都可被称为SQL或PL/SQL语句,函数主要分为两大类: 单行函数 组函数 本文将讨论如何利用单行函数以及使用规则。 SQL中的单行函数 SQL和PL/SQL中自带很多类型的函数,有字符、数字
查看表空间利用率的查询语句
SELECT UPPER(F.TABLESPACE_NAME) "表空间名", D.TOT_GROOTTE_MB "表空间大小(M)", D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空间(M)", TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100, 2), '990.99') "使用比", F.TOTAL_BYTES "空闲空间(M)", F.MAX_BYTES "最大块(M)" FROM (SELECT TABLESPACE_NAME, ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES, ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES FROM SYS.DBA_FREE_SPACE GROUP BY
Oracle Index Organized Tables (IOT)
GeneralNote: Index Organized Tables are tables that, unlike heap tables, are organized like B*Tree indexes.[@more@]Oracle Index Organized Tables (IOT)Version 10.2 GeneralNote: Index Organized Tables are tables that, unlike heap tables, are organized like B*Tree indexes.Note: From Jonathan Lewis on secondary indexesI think secondary indexes on IOTs need some careful testing. It's probably not an area that many people have used in a high-stress environment. There are two main issues: The primary k
Using the Database Resource Manager
Oracle Database provides database resource management capability through its Database Resource Manager. This chapter introduces you to its use and contains the following topics:[@more@]Using the Database Resource ManagerOracle Database provides database resource management capability through its Database Resource Manager. This chapter introduces you to its use and contains the following topics:What Is the Database Resource Manager?Administering the Database Resource ManagerCreating a Simple Reso
Recovery Manager (RMAN) Enhancements In Oracle9i
Customizable Configuration ParametersThe CONFIGURE command can be used to set certain parameters once for all subsequent jobs. This data is stored in a controlfile which can be resynchronized to the recovery catalog.A Rentention Policy defines which backup are no longer needed. This can be configured in one of two ways: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS; CONFIGURE RETENTION POLICY TO REDUNDANCY 5; CONFIGURE RETENTION POLICY TO NONE;[@more@]Recovery Manager (RMAN) Enhancem