Posts

import data from xml file to sql server table

Sample xml file- 1001 Sagar 2011-05-05T09:25:48.253 c40 noida 1002 himalaya 2011-05-05T09:25:48.253 c6. noida The table needs to be created having column names same as tags name of xml file Here as per example xml file- create TABLE XMLTABLE (CustID INT, CustLastName VARCHAR(10) , DOB DATETIME, Addr1 VARCHAR(100), City VARCHAR(10)) then run the following query to import data- insert into XMLTABLE select c3.value('CustID[1]','int'), c3.value('CustLastName[1]','varchar(10)'), c3.value('DOB[1]','DATETIME'), c3.value('(Address/Addr1)[1]','VARCHAR(100)...

some good books regarding DB2

https://www.dropbox.com/sh/4jfzwbi1a0x66jj/aGlDv7daWX please download them from this dropbox link :)

LUN management basics

Image
A logical unit number (LUN) is a unique identifier used to designate individual or collections of  hard disk  devices for address by a protocol associated with a  SCSI ,  iSCSI , Fibre Channel ( FC ) or similar interface. LUNs are central to the management of block storage  arrays  shared over a storage area network ( SAN ).  The term LUN dates back to the early days of  SCSI  when each device was identified by a logical number, up to eight in those days. Now servers with a dozen or more LUNs are common and it's getting less common for them to be connected to a conventional internal SCSI disk array. However, the basic element of storage for the server is still referred to as the LUN. Each LUN identifies a specific logical unit, which may be a part of a hard disk drive, an entire hard disk or several hard disks in a storage device. So a LUN could reference an entire RAID  set, a single disk or  partition , or multiple hard d...

MCTS (70-432) DBA Exam

Image
The MCTS Exam 70-432 focuses on 8 main areas: Installing and configuring Maintaining instances Managing security Database maintenance Data management Monitoring and troubleshooting High availability Let’s take a closer look at the 8 areas. 1. Installing and Configuring SQL Server 2008 (10%) Installing and configuring Microsoft SQL Server 2008 takes up 10% of the exams questions and assumes you are familiar with: installing and configuring server instances including using the configuration manager and SQL browser; the standard of being able to install Microsoft SQL Server 2008 and related services as well as knowing the installation paths, file locations, etc. You can refer to this MSDN article on how to install Microsoft SQL Server 2008 ; being able to configure additional SQL Server components such as SQL Server Integration Services (SSIS), SQL Server Analysis Services (SSAS), SQL Server Reporting Services (SSRS), etc.; being able to implement database mail...

huge log file

Just try this.  select log_reuse_wait_desc,* from sys.databases where name='dbname' -- see what it is waiting on also run this dbcc sqlperf(logspace) -- see log space utilization   If your recovery model is FULL, follow the below steps 1. Take a full database backup 2. Shrink the log file to an appropriate size 3. Take a full database backup again 4. Schedule transaction log backups to avoid such issues in the future This is a problem for two basic reasons. By default, new databases are created in full recovery mode AND by default, no one has set up log backups on your system. That means it’s up to you. You have to set up log backups. You have to set them and you have to schedule them and you have to ensure they run if you want to recover your database to a point in time, which is also known as, Full Recovery. Though this would have solved the problem, I'm still interested in showing what t-logs are upto actually. What is the Transaction Log? At its simplest,...

query the total memory in the system that runs the SQL Server

you can use the following query hope it helps-   -- We don't need the row count  SET NOCOUNT ON  -- Get size of SQL Server Page in bytes  DECLARE @pg_size INT, @Instancename varchar(50)  SELECT @pg_size = low from master..spt_values where number = 1 and type = 'E'  -- Extract perfmon counters to a temporary table  IF OBJECT_ID('tempdb..#perfmon_counters') is not null DROP TABLE #perfmon_counters  SELECT * INTO #perfmon_counters FROM sys.dm_os_performance_counters  -- Get SQL Server instance name  SELECT @Instancename = LEFT([object_name], (CHARINDEX(':',[object_name]))) FROM #perfmon_counters WHERE counter_name = 'Buffer cache hit ratio'  -- Print Memory usage details  PRINT '----------------------------------------------------------------------------------------------------'  PRINT 'Memory usage details for SQL Server instance ' + @@SERVERNAME + ' (' + CAST(SERVERPROPERTY('productversion') AS VARCHAR) + ' -...

Parallel Processing Using Jobs

Parallel Processing Using Jobs We'll create the 'job queue' and fill it with sample 'waitfor delay' commands with variable wait time using rand() function. The jobs will just simulate the work. create table #job_queue ( id int identity ( 1 , 1 ) primary key , exe_proc varchar ( 255 )) declare @create_job nvarchar ( max ), @db_name sysname , @job_name varchar ( 255 ) declare @val int , @command nvarchar ( max ), @delay varchar ( 16 ), @i int set @db_name = db_name () set @i = 1 while @i <= 100     begin         insert #job_queue values ( 'waitfor delay ''''0:0:' + cast ( ceiling ( rand () *10 ) as varchar ( 3 ))+ '''''' )         set @i = @i+1     end 2. Starting the main loop. Create the SQL for the job first: while exists ( select 1 from #job_queue ) begin   select top 1 @val = id , @comman...