04 2014 档案
摘要:转自http://www.nowamagic.net/librarys/veda/detail/1502我们做软件开发的,大部分人都离不开跟数据库打交道,特别是erp开发的,跟数据库打交道更是频繁,存储过程动不动就是上千行,如果数据量大,人员流动大,那么我们还能保证下一段时间系统还能流畅的运行吗?我...
阅读全文
摘要:--动态语句语法/*********************************************************************************************************************************************...
阅读全文
摘要:Read committed is thesecond weakestof the four isolation levels defined by the SQL standard. Nevertheless, it is the default isolation level for many ...
阅读全文
摘要:fromhttp://blog.sqlauthority.com/2010/07/04/sql-server-index-levels-page-count-record-count-and-dmv- sys-dm_db_index_physical_stats/In the recentQuery...
阅读全文
摘要:fromhttp://aboutsqlserver.com/2013/10/15/sql-server-storage-engine-data-pages-and-data-rows/The space in the database divided into logical 8KB pages. ...
阅读全文
摘要:转自http://blog.csdn.net/sqlserverdiscovery/article/details/12622793在SQL Server中,一般我们都会通过 select * from 表 来查询数据,但有时候,为了探索SQL Server的各种机制,需要看到更原始的数据,或者说是...
阅读全文
摘要:You can create a partitioned table or index in SQL Server 2012 by using SQL Server Management Studio or Transact-SQL. The data in partitioned tables a...
阅读全文
摘要:DatabasesHow to: Add Data or Log Files to a Database (SQL Server Management Studio)How to: Attach a Database (SQL Server Management Studio)How to: Cha...
阅读全文
摘要:this topic shows the mapping between the system tables and functions and system views and functions.The following table maps the system tables to thei...
阅读全文
摘要:This topic contains a list of frequently asked questions. The answers to these questions are queries that are based on catalog views.Frequently Asked ...
阅读全文
摘要:From http://technet.microsoft.com/en-us/library/ms188754.aspx1.AlwaysOn Availability Group Dynamic Management Views and Functionssys.dm_hadr_auto_page...
阅读全文
摘要:This query is quite useful when looking at which partitions are in the database. It is originally taken from the bookMicrosoft SQL Server 2008 Interna...
阅读全文
摘要:I encountered a problem about a query not using a particular indexed view in SQL Server 2005. To investigate this issue, I figured that I would go abo...
阅读全文
摘要:What better way to kick off a new year than with a look back at some of the top free SQL Server tools of 2012.I know you all lovetalking aboutyourfavo...
阅读全文
摘要:I came across a question in the relationalserver.performance newsgroup where a customer was wondering about the spools seen in a recursive query execu...
阅读全文
摘要:Causes SQL Server to display information regarding the amount of disk activity generated by Transact-SQL statements. SyntaxSET STATISTICS IO { ON | OF...
阅读全文
摘要:Last year Tibor Karaszi posted a blog post titledMatch Those Typesthat talked about implicit data type conversions associated with mismatched data typ...
阅读全文
摘要:This week, T-SQL Tuesday is being hosted by Jes Borland (blog|twitter), and the theme is "Aggregate Functions."When people think of aggregates, they t...
阅读全文
摘要:All functions that exist in SQL Server are either deterministic or nondeterministic. The determinism of a function is defined by the data that is retu...
阅读全文
摘要:SQL Server游标语句1.声明游标declare myCursor cursor[global | local][forward_only | scroll][static | keyset | dynamic | fast_forward][read_only | optimistic | ...
阅读全文
摘要:So you thought that encapsulating code in user-defined functions for easy reuse is a good idea? Think again!SQL Server supports three types of user-de...
阅读全文
摘要:fromhttp://www.dbaref.com/top-20-dictionary-views1. VSESSIONdisplays session information for each current session.ColumnDatatypeDescriptionS...
阅读全文
摘要:This is not an article on how to tune queries (that subject would take a book), but an article on how to use the often overlooked Transact-SQL SET STA...
阅读全文
摘要:转自http://sqlblog.com/blogs/jonathan_kehayias/archive/2010/12/21/an-xevent-a-day-21-of-31-the-future-tracking-blocking-in-denali.aspxOne of my favorite...
阅读全文
摘要:转自http://lzf328.blog.51cto.com/1196996/1363340扩展事件提供了一个轻量级的平台可以用来收集错误信息,方便DBA查看最近的数据库错误配合开发人员一起解决问题。下面的例子我们创建extendedevent会话来获取错误208,2812,and4121。这三个错...
阅读全文
摘要:转自http://lzf328.blog.51cto.com/1196996/1363033如果Windows账户无法连接并且SA密码也丢失了,那么如何可以连接到数据库呢?答案是:在单用户模式下启动SQLServer然后用本地管理员权限连接。登陆之后就可以修改SA密码了。步骤:1.打开SQLServ...
阅读全文
摘要:转自http://lzf328.blog.51cto.com/1196996/1345166今天用SetStatisticistime比较语句的执行时间,信息如下:SQLServerExecutionTimes:CPUtime=199229ms,elapsedtime=156327ms.SQLSer...
阅读全文
摘要:The SQL Server Database Engine uses the following mechanisms to ensure the integrity of transactions and maintain the consistency of databases when mu...
阅读全文
摘要:Many of the system tables from earlier releases of SQL Server are now implemented as a set of views. These views are known as compatibility views, and...
阅读全文
摘要:An information schema view is one of several methods SQL Server provides for obtaining metadata. Information schema views provide an internal, system ...
阅读全文
摘要:This topic shows the mapping between the system tables and functions and system views and functions.The following table maps the system tables to thei...
阅读全文
摘要:重建索引是为了减少数据碎片。数据碎片会导致SQL Server进行不必要的数据读,降低SQL Server的性能。重建索引也会同时更新列统计,而如果查询所使用的列缺少或遗漏统计信息,这可能导致SQL Server内部的优化器选择比预期效率低的查询计划。如果您重建了某张表上的聚集索引,该表上的非聚集索...
阅读全文
摘要:转自http://rusanu.com/2009/08/05/asynchronous-procedure-execution/Update:a version of this sample that accepts parameters is available in the postPassin...
阅读全文
摘要:转自http://technet.microsoft.com/en-us/library/ms189823(v=sql.105).aspxPlaces a lock on an application resource.Transact-SQL Syntax ConventionsSyntaxsp_...
阅读全文
摘要:转自http://www.mssqltips.com/sqlservertip/1841/auto-generate-an-hourly-sql-server-profiler-trace-file/ProblemWhile investigating performance issues as a...
阅读全文
摘要:Executing a ROLLBACK TRANSACTION or COMMIT TRANSACTION Transact-SQL statement inside a stored procedure or trigger is possible, but doing so may cause...
阅读全文
摘要:转自http://www.sqlservergeeks.com/blogs/sarab/sql-server-bi/184/types-of-transactions-in-sql-serverThere are four types of transactions in SQL Server.Au...
阅读全文
摘要:转自http://www.sqlservercurry.com/2011/01/rollback-nested-transactions-in-stored.htmlIn a previous articleRollback Transaction in SQL Server, l explaine...
阅读全文
摘要:转自http://technet.microsoft.com/en-us/library/ms188378(v=sql.110).aspxSyntaxSAVE { TRAN | TRANSACTION } { savepoint_name | @savepoint_variable }[ ; ]Ar...
阅读全文
摘要:转自http://geekswithblogs.net/bbiales/archive/2012/03/15/how-to-nest-transactions-nicely---quotbegin-transactionquot-vs-quotsave.aspxDo you write stored...
阅读全文
摘要:转自http://www.mssqltips.com/sqlservertip/1715/scheduling-a-sql-server-profiler-trace/ProblemYou want to schedule a trace, but SQL Profiler does not hav...
阅读全文
摘要:转自http://rusanu.com/2009/06/11/exception-handling-and-nested-transactions/I wanted to use a template for writing procedures that behave as intuitively...
阅读全文
摘要:使用整数数据的精确数字数据类型。bigint从 -2^63 (-9223372036854775808) 到 2^63-1 (9223372036854775807) 的整型数据(所有数字)。存储大小为 8 个字节。int从 -2^31 (-2,147,483,648) 到 2^31 - 1 (2,...
阅读全文
摘要:转自http://blog.sqlauthority.com/2009/12/15/sql-server-difference-temptable-and-table-variable-temptable-in-memory-a-myth/Recently, I have been conducti...
阅读全文
摘要:转自 http://www.mssqltips.com/sqlservertip/2825/sql-server-temp-table-vs-table-variable-performance-testing/ProblemIf you've been a DBA for any amount o...
阅读全文
摘要:转自http://www.mssqltips.com/sqlservertip/1556/differences-between-sql-server-temporary-tables-and-table-variables/ProblemI've heard of table variables,...
阅读全文
摘要:Grants permissions on a server. Transact-SQL Syntax Conventions Syntax GRANT permission [ ,...n ] TO [ ,...n ] [ WITH GRANT OPTION ] [ AS ] :...
阅读全文
摘要:转自http://technet.microsoft.com/en-us/library/ms189292%28v=sql.105%29.aspxYou can define indexes on computed columns as long as the following requireme...
阅读全文
摘要:Using @DataSourceDefinition to configure a DataSourceDefining a Managed DataSourceLinksInstalling the JDBC DriverInstalling a JDBC driver as a deploymentModify the JARInstalling a JDBC driver as a moduleDefining the DataSource itselfIn older versions of the application server, data source configurat
阅读全文
摘要:1.Introduction to the Build Lifecyclehttp://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html2. Maven Assembly plugin Exampleshttp://maven.apache.org/plugins/maven-assembly-plugin/examples/index.html3. Maven Assembly Plugin overviewhttps://maven.apache.org/plugins/maven-assembl
阅读全文
摘要:转自http://blog.csdn.net/wangjunjun2008/article/details/11201869使用Maven对Web项目进行打包,默认为war包;但有些时候,总是希望打成zip包(亦或其他压缩包),maven-war-plugin插件就无能为力了,这时就用到了maven-assembly-plugin插件了,官方网址:http://maven.apache.org/plugins/maven-assembly-plugin/该插件能打包成指定格式分发包,更重要的是能够自定义包含/排除指定的目录或文件(遗留项目中,过滤配置文件时,或者仅仅需要发布图片或者CSS/JS
阅读全文
摘要:AssemblyMaven Assembly Plugin relies on the provided assembly descriptors to dictate its execution. Although there are already prefabricated descriptors available for use, they can only suffice some of the common assembly requirements.So in order for you to customize the way the Assembly Plugin crea
阅读全文
摘要:Dealing with the large object (LOB) data types (text, ntext,andimage)is a little more complex than dealing with the other types, as you probably know. When you throw in thetext in rowoption, which specifies that small amounts of data can be stored in the data row instead of on separate pages, you ha
阅读全文
摘要:Free tools that help you solve problems are always handy. Take a look at these five useful and free SQL Server tools that can make you more productive, help you experience fewer hassles, and maybe even lower your job stress.ApexSQL RefactorRed Gate's SQL Search 1SolarWinds' Free Database Mon
阅读全文
摘要:转自http://www.mssqlcity.com/Articles/Undoc/SQL2000UndocSP.htmIn this article, I want to tell you about some useful undocumented stored procedures shipped with SQL Server 2000.sp_MSget_qualified_nameThesp_MSget_qualified_namestored procedure is used to get the qualified name for the given object id.Sy
阅读全文
摘要:转自http://www.poorren.com/sqlserver-2005-varcharmax-nvarcharmax-varbinarymax/在Microsoft SQLServer2005及以上的版本中,对于varchar(n)、nvarchar(n)和varbinary(n)有了max的扩展。可以使用如:varchar(max)、nvarchar(max)和varbinary(max)的大值数据类型来存储最多2^30-1个字节的数据。这几个数据类型在行为上和较小的数据类型 varchar、nvarchar 和 varbinary 相同。微软的说法是用这个数据类型来代替之前的tex
阅读全文
摘要:转自http://blog.csdn.net/xianshengsun/article/details/7657551方法一:select object_name(id) tablename,8*reserved/1024 reservedMB,rtrim(8*dpages/1024)+'Mb' used,8*(reserved-dpages)/1024 unused,8*dpages/1024-rows/1024*minlen/1024 free,rows,* from sysindexeswhere indid=1order by reserved desc方法二:if n
阅读全文
摘要:Updates the metadata for the specified non-schema-bound view. Persistent metadata for a view can become outdated because of changes to the underlying objects upon which the view depends.Transact-SQL Syntax ConventionsSyntaxsp_refreshview [ @viewname= ] 'viewname'Arguments[@viewname=]'vie
阅读全文
摘要:转自 http://www.dba-oracle.com/sf_ora_29857_domain_indexes_and_or_secondary_objects_exist_in_the_tablespace_bc1.htmOracle docs note this about ORA-29857...
阅读全文
摘要:转自http://sqlmag.com/t-sql/varbinarymax-tames-blobLike the jelly-like Blob monster in those old Steve McQueen horror movies, mixing binary large objects (BLOBs) with relational database data has traditionally been unnatural and difficult to manage. BLOBs and relational database data are very differen
阅读全文
摘要:来之itpub帖子http://www.itpub.net/thread-1853767-1-1.html表数据idvalue1 992 1023 1104 1155 120期望结果:idvalue detal1 99 02 102 33 110 84 115 55 120 5方法一: last_value() over()with t as (select 1 id, 99 value from dual union select 2, 102 from dual union select 3, 110 from dual union selec...
阅读全文
摘要:转自 http://www.mssqltips.com/sqlservertip/1047/specifying-max-degree-of-parallelism-in-sql-server-for-a-query/ProblemThe Max Degree of Parallelism or MAXDOP is a configuration indicating how the SQL Server optimizer will use the CPUs. This is a server wide configuration that by default uses all of th
阅读全文
摘要:转自 http://www.cnblogs.com/yubo/archive/2010/04/23/1718810.html从系统架构来看,目前的商用服务器大体可以分为三类,即对称多处理器结构 (SMP : Symmetric Multi-Processor) ,非一致存储访问结构 (NUMA : ...
阅读全文
摘要:SCM使用GIT而非SVN时,使用Maven发布,总是会出一些莫名其妙的问题,google查找原因,无意中看到了这个插件;对于该插件,到目前为止,文档比较少,尤其是中文的文档;全部的信息都包含在项目说明文件中了;项目地址:https://github.com/ktoso/maven-git-commit-id-plugin作者说该插件类似于 buildnumber-maven-plugin 插件(关于该插件,可参考http://blog.csdn.net/u011453631/article/details/10394475),并对其进行了扩展。buildnumber-maven-plugin
阅读全文
摘要:转自http://blog.csdn.net/wangjunjun2008/article/details/10394475某些情况下(这种情况一般很少见),使用maven构建项目时,需要一个不重复的序列号,比如说,打包时,包名称以当前构建时间结尾,或者每次生成的jar包中包含唯一的序列号,等等;这个时候,就用到了buildnumber插件,官方网址:http://mojo.codehaus.org/buildnumber-maven-plugin/index.html该插件能按照指定的方案生成序列号;首先引入该插件[html] view plaincopyorg.codehaus.mojob
阅读全文
摘要:转自http://intermediatesql.com/oracle/oracle-11g-sql-plan-management-or-yet-another-way-why-oracle-may-not-use-your-index-part-1/One of our developers called me recently and said that they had an interesting problem on their hands.The essence of a problem was that the schema upgrade script misfired an
阅读全文
摘要:转自http://intermediatesql.com/oracle/how-to-add-a-hint-to-oracle-query-without-touching-its-text/If you’ve been aDBAlong enough, you’ve probably seen multiple cases where certainSQLqueries just refuse to cooperate.I.e. youKNOWthat the query is supposed to use indexIDX1, butORACLEstubbornly decides to
阅读全文
摘要:转自http://intermediatesql.com/performance/how-to-track-sql-performance-part-3-getting-down-to-business/In theprevious article, I introduced the concept ofpercentilesand you can hopefully see that measuring percentiles is important to trackSQLperformance as it makes performance metrics a lot more prec
阅读全文
摘要:转自http://intermediatesql.com/performance/how-to-track-sql-performance-part-2-percentiles/In theprevious article, we’ve seen that “average” SQL perform...
阅读全文
摘要:转自http://intermediatesql.com/oracle/how-to-find-spm-baseline-by-sql_id/When you start working withSQLPlan baselines, one of the annoying things that y...
阅读全文
摘要:转自http://intermediatesql.com/oracle/the-troubling-global-nature-of-sql-profiles-and-spm-baselines/Did you know thatSQLprofiles andSPMbaselines collect...
阅读全文
摘要:转自http://intermediatesql.com/oracle/what-is-the-difference-between-sql-profile-and-spm-baseline/Note----- -SQLprofile"SYS_SQLPROF_012ad8267d9c0000"use...
阅读全文
摘要:转自http://intermediatesql.com/oracle/what-are-sql-profiles-and-why-do-we-need-them/If you useDBMS_XPLANpackage to analyze execution plans for yourSQLst...
阅读全文
摘要:Let’s say that you have a very importantSQLin your system.How do you know if it is performing well ? Is it running slow sometimes resulting in users h...
阅读全文
摘要:AkadiaInformation TechnologyConnecting toOracle 9usingtheMicrosoft .NET FrameworkOracle Database Access using .NET Data ProvidersOracle Database Trans...
阅读全文
摘要:AkadiaInformation TechnologyUsing UTL_TCP to send E-Mail from PL/SQL with Oracle 8.1.6Show Oracle Version and installed OptionsOracle 8i temporary Tab...
阅读全文
摘要:AkadiaInformation TechnologyCREATE TABLE AS and LONG RAWSizing of Locally Managed TablespacesOracle8i: How to migrate LONG RAW to BLOBNet8 access trou...
阅读全文
摘要:AkadiaInformation TechnologyLoading LOBs into Oracle using SQL*LoaderUse Oracle9i SPFILE to overcome traditional PFILE LimitationsThe Default Temporar...
阅读全文
摘要:转自http://www.akadia.com/services/ora_important_part_1.htmlAkadiaInformation TechnologyWo sind die Default NLS-Parameter definiertDatum Arithmetic mit ...
阅读全文
摘要:Sometimes when an attendee describes me some totally weird problem during a seminar, I am immediately able to answer something like “Hey this looks li...
阅读全文
摘要:转自http://blog.tanelpoder.com/2009/11/04/detect-chained-and-migrated-rows-in-oracle/?subscribe=success#blog_subscription-3I received a question about m...
阅读全文
摘要:转自http://intermediatesql.com/oracle/how-to-find-if-your-sql-is-using-spm-baseline/I’ve always wondered how many of mySQLs areNOTusing baselines.Of cou...
阅读全文
摘要:PL/SQL 中没有split函数,需要自己写。 代码:--创建一个type,如果为了使split函数具有通用性,请将其size 设大些。create or replace type type_split as table of varchar2(50); --创建functioncreate ...
阅读全文
摘要:转自http://blog.csdn.net/mybluetiankong/article/details/18558213适用于:Oracle Database - Enterprise Edition - 版本 10.2.0.1 和更高版本本文档所含信息适用于所有平台目标本文旨在提供如何解释跟数据库性能问题息息相关的AWR信息。需要注意的是生成 AWR Report 或访问 AWR 相关的视图,以及使用任何 AWR 相关的诊断信息,都需要额外的 Diagnostic Pack License。这包括生成 AWR/ADDM/ASH report,也包括当技术支持要求的生成上述报表时。注意:
阅读全文
摘要:我们知道通过启动Oracle内部事件可以获得更多额外的可用信息,但是如何知道每个事件对应哪些功能呢?这里可以使用pl/sql来获取所有事件的名称。SETlinesize200SETfeedbackoffSETSERVEROUTPUTONDECLAREerr_msgVARCHAR2(200);BEGINdbms_output.enable(1000000);FORerr_numIN10000..10999LOOPerr_msg:=SQLERRM(-err_num);IFerr_msgNOTLIKE'%Message'||err_num||'notfound%'TH
阅读全文
摘要:转自http://intermediatesql.com/oracle/oracle-11g-sql-plan-management-the-dark-side-of-spm-part-4/#Scenario_3:_The_PRECAUTION:_Dont_like_binds__Watch_out...
阅读全文
摘要:转自http://www.oracle-base.com/articles/11g/sql-plan-management-11gr1.phpSQL plan management provides a mechanism for maintaining consistent SQL performance regardless of changes in optimizer version, optimizer statistics, schema changes, system settings and SQL profile creation.How Does SQL Plan Mana
阅读全文