2011年11月续
2011年11月28日 星期一①VB.NET中的函数可以返回使用表的主键值Public Function AddNoticeAlreadyRead(ByVal ent As Entity.Entity.EntNoticeAlreadyRead) As Integer Try strSQL = "INSERT INTO Tbl_NoticeAlreadyRead(NoticeId,NARAlreadyReadUser,NARAlreadyReadTime) VALUES(" + ent.NoticeId.ToString() + ",'" + ent.NARAlreadyReadUser + "','" + ent.NARAlredyReadTime + "'); SELECT @@IDENTITY" If Not CargoBookingDBConnect() Then End If Sqlcmd = New Sql
查找HWM的方法
/*在表的segment header里记录了一个值,叫高水位标记(High Water Mark,简称HWM)。HWM表示当前segment里使用的最后一个数据块的位置。当发生insert时,由于不断扩展数据块,因此会不断增加HWM的值。*/DECLARE L_TOTAL_BLOCKS NUMBER; --表示表里占用的数据块的总个数 L_TOTAL_BYTES NUMBER; L_UNUSED_BLOCKS NUMBER; L_UNUSED_BYTES NUMBER; L_LASTUSEDEXFILEID NUMBER; L_LAST_USED_EXTENT_BLOCK_ID NUMBER; --表里最后使用的EXTENT的起始数据块号 L_LAST_USED_BLO
Oracle视图:常用数据字典
1、DICT显示当前用户可访问的所有数据字典视图。2、DICT_COLUMNS显示数据字典视图每个列的作用。3、DUAL用于取得函数的返回值。[@more@]4、GLOBAL_NAME显示当前数据库的全名。5、IND显示当前用户所拥有的所有索引和索引统计信息。6、OBJ显示当前用户所用有的所有对象。7、SEQ显示当前用户所拥有的所有序列。8、SYN显示当前用户所拥有的同义词和同义词所对应的数据库对象名。9、TAB显示当前用户所拥有的表、视图和序列。
Oracle视图:常用动态性能视图
1、V$FIXED_TABLE作用:列出所有可用的动态性能视图和动态性能表。2、V$INSTANCE作用:用于取得当前例程的详细信息。3、V$SGA作用:显示SGA主要组成部分(共享池、数据高速缓存和重做日志缓冲区)的尺寸。[@more@]4、V$SGAINFO作用:用于取得SGA更详细的信息5、V$PARAMETER 作用:用于取得初始化参数的详细信息。6、V$VERSION作用:用于取得Oracle版本的详细信息。7、V$OPTION作用:用于显示已经安装的Oracl选项。TRUE表示该选项已经安装,FALSE表示该选项没有安装。8、V$SESSION作用:用于显示会话的详细信息。 SID 会话ID
由ODBC连通Oracle与SQL Server
/*---------------------------Author : lonionReference : article1,article2Date : 2011-10-30-------------------------------*/由ODBC连通Oracle与SQL Server1、在Oracle服务器上建立一个odbc数据源(系统DSN)。示例中建立的数据源为ODBC251。2、配置inithsodbc.ora在Oracle数据库的主目录下有一个inithsodbc.ora文件($ORACLE_HOMEhsadmin),复制一份并重命名为init<SID>.ora,放在该目录下。示例中使用的SID为HS251,即创建了一个initHS251.ora文件,该文件的内容如下:HS_FDS_CONNECT_INFO = ODBC251 --所建立的odbc数据源。
设置日志缓冲区(log buffer)
在设置日志缓冲区时,可以参考这个建议的公式来计算:1.5*(平均每个事务所产生的重做记录*每秒提交的事务数量)。总事务量SQL> SELECT A.VALUE AS TRANCOUNT FROM V$SYSSTAT A ,V$STATNAME B WHERE A.STATISTIC#=B.STATISTIC# AND B.NAME='user commits';系统总共运行的时间:SQL> SELECT TRUNC(SYSDATE-STARTUP_TIME)*24*60*60 AS SECONDS FROM V$INSTANCE;产生的所有重做记录大小SQL> SELECT VALUE AS REDOBLOCKS FROM V$SYSSTAT WHERE NAME='redo blocks written';日志缓冲区大小=1.5*(redoblocks/trancount)*(trancount/secon
Oracle视图:V$SYSSTAT
This view lists system statistics. To find the name of the statistic associated with each statistic number (STATISTIC#), query the V$STATNAME view.该视图列出了系统的统计信息,查询视图V$STATNAME来找到每个统计号(STATISTIC#)所对应的统计名称。[@more@]列名 列描述--------------- ------------------------------STATISTIC# 统计编号NAME 统计名 CLASS 统计类别 ·1 - User ·2 - Redo
Oracle视图:V$ROLLNAME
This view lists the names of all online rollback segments. It can only be accessed when the database is open.[@more@]列 列描述----- ---------------USN 回滚段编号NAME 回滚段名PS:V$TRANSACTION.XIDUSN=V$ROLLNAME 官网文档
下载附件代码(VB.NET)
存储附件的表LONION_FUJ,表结构如下:NAId ----->附件IDNAFileName ----->附件名NAFilePath ----->附件路径点击某个按钮或触发某个事件下载附件,代码如下:[@more@]Protected Sub ViewButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim i As Integer = DataList1.EditItemIndex Dim label As Label = (CType(DataList1.Items(i).FindControl("m_id"), Label)) Dim strSQL As String = "SELECT * FROM LONION_FUJ WHERE NOTICEID = " + label.Text T
Oracle Data Guard:物理Standby配置(参考文档)
/*---------------Author : lonionReference : Here.Date : 2011-10-30Data Guard的物理备库的配置将以此文档为参考文档-----------------------------------------------*/Oracle 10g - Manually Create a Physical Standby Database Using Data Guard操作系统:Red Hat Enterprise Linux 5 Data Guard数据保护模式:最高性能(默认)配置Data Guard环境:主库● IP:192.168.1.100● 数据库SID:lonion● DB_NAME:lonion● DB_UNIQUE_NAME:PRIM● 数据库软件安装路径:/u01/app/oracle/product/10.2.0/db_1/备库● IP:192.168.1.105● 数据库
2011年11月
2011年11月18日 星期五①VB.NET中Pag_Load事件,关乎数据绑定If Not IsPostBack ThenDataBinds()End If2011年11月17日 星期四①首先ASP.NET中的DataList数据绑定控件。2011年11月16日 星期三①EXISTS与NOT EXISTS的使用,还得继续强化使用技巧。2011年11月15日 星期二①VB.NET中ViewState的使用2011年11月14日 星期一①Dim dr As DataRow ---今天要学习的。For Each dr In dt.RowsDim funwebkey As Integer = CType(dr("funwebkey"), Integer)Dim funcid As String = dr("funcid").ToString()Dim desp As String = dr
2011年10月
2011年10月20日 星期二 ~ 2011年11月01日 星期一完成VB程序.....2011年10月19日 星期一①DBA与SYSDBA的区别②orapwd创建密码文件orapwd: ·file:指定密钥文件名称和路径 ·password:SYS用户密码 ·entries:指定该数据库能够拥有SYSDBA权限的用户最大数。 ·force:如果文件存在是否覆盖。相关视图:V$PWFILE_USERS;需要注意Windows平台和Linux/UNIX平台密钥文件的命名规则并不相同:·Windows平台命名规则:PWD[SID].ORA·Linux/UNIX平台命名规则:orapw[sid]③视图V$PWFILE_USERS查询拥有SYSDBA权限的用户。201
2011年09月
2011年09月30日 星期五①对Oracle SQL Developer3.0移植第三方数据库到Oracle官方文档的翻译。移植测试。2011年09月29日 星期四①对Oracle SQL Developer3.0移植第三方数据库到Oracle官方文档的翻译。2011年09月28日 星期三①VB、复选框勾选触发某一事件时:对应复选框的属性AutoPostBack值应为True对应的事件为CheckedChanged②javascript中调用VB的函数参考 ---- CargoBookingWorldWeb.Change_password.aspx中的Imports AjaxPro<AjaxPro.AjaxMethod()> _Functio 函数名(...........) As Boolean③ 显示SQL的执行时间、执行计划SQL
2011年09月续
2011年09月25日 星期日①format=string文件路径和名称的格式串,其中的含义是:%c copy ID%p backup piece ID%s backup set ID%e log Sequence%h log thread ID%d database name%n database name(x填充到8个字符)%I DBID%f file ID%F DBID , day ,month ,year and sequence的复合格式%N tablespace name%t timestamp%M mh mm格式%Y year yyyy格式%u backup set+time(x填充到8个字符))%U %u_%p_%c②alter system switch logfile与alter system archive log current的区别http://wenku.baidu.com/view/2421e8244b35eefdc8d333f4.html2011年0
ORA-01996
[oracle@lonion ~]$ oerr ora 01996ORA-01996:GRANT failed: password file '' is full 这种错误通常出现在给某用户授予SYSDBA权限时出现。查询视图V$PWFILE_USERS,看看拥有SYSDBA权限的用户是否超过了密钥文件里规定的个数。[@more@]
ORA-01078
[oracle@lonion ~]$ oerr ora 01078 【案例出现在Oracle11g】ORA-01078:failure in processing system parameters// *Cause:Failure during processing of INIT.ORA parameters during system startup.// *Action:Further diagnostic information should be in the error stack.附带的错误LRM-00109: could not open parameter file '.......'出现错误的原因:在修改oracle用户环境变量的时候指定export ORACLE_SID=lonion,但是在安装数据库是却将数据库SID指定为另一个名称(假定是oracle11g),这就是错误所在。解决办法尝试重新修改oracl
ORA-27102
[oracle@lonion ~]$ oerr ora 27102 【案例出现在Oracle11g】ORA-27102:out of memory// *Cause: Out of memory// *Action: Consult the trace file for details这个问题是安装好Oracle11g后启动数据库时出现的,当时是这样子解决的:修改操作系统的内核参数设置# vi /etc/sysctl.conf将kernel.shmmax = (物理内存的一半G)*1024*1024*1024(采用三思的建议)[@more@]
ORA-01536
[oracle@lonion ~]$ oerr ora 01536 【案例出现在Oracle11g】ORA-01536: space quota exceeded for tablespace 'string' // *Cause: The space quota for the segment owner in the tablespace has been exhausted and the operation attempted the creation of a new segment extent in the tablespace.// *Action: Either drop unnecessary objects in the tablespace to reclaim space or have a privileged user increase the quota on this tablespace for the segment owner.出现的原因可能:使用REVOKE UNLIMITED TABLESPACE命令后
ORA-00845
[oracle@lonion ~]$ oerrora 00845(通常在IMP导入数据时出现)【案例出现在Oracle11g】ORA-00845: MEMORY_TARGET not supported on this system// *Cause:The MEMORY_TARGET parameter wasnot supportedon this operatingsystem or /dev/shm wasnot sized correctlyon Linux.// *Action: Referto documentationfor alist of supported operating systems.Or,size /dev/shmto beat least the SGA_MAX_SIZEon each Oracleinstance runningon the system.出现的原因可能:Oracle 11g的Linux版本在修改了MEMORY_TARGET或者SGA_TARGET后启动可
ORA-08189
[oracle@lonion ~]$ oerr ora 08189ORA-08189: cannot flashback the table because row movement is not enabledORA-08189:不能闪回表,因为未启用行移动功能08189, 00000, "cannot flashback the table because row movement is not enabled"// *Cause: An attempt was made to perform Flashback Table operation on a table for which row movement has not been enabled. Because the Flashback Table does not preserve the rowids, it is necessary that row movement be enabled on the table.// *Action: Enable row