Trigger Writing Across Physical Disks

Feb 27, 2001

Any help appreciated!
Is there any performance enhancements to be gained by storing frequently 'trigger-written-to' databases on a seperate disk to the source database? In particular, we keep a 'history' database of all inserts/updates/deletes against records, activated by triggers, and I was wondering if I would gain performance enhancement by locating the two databases on different disks?
Thanks in advance

View 2 Replies


ADVERTISEMENT

Need Help Writing A Trigger

Nov 20, 2003

Please find the necessary SQL scripts to generate a small version of my database and some data at the bottom of this post.

Here's a short description of what the database is all about: It's a project tracking and management system. Contracts go into the tblDeals table. Because each project may be different in nature, project phases are defined in tblPhaseType and tblPhase tables. The table used to keep track of what's going on is the tblProduction table.

Here's what I need to do. When a project is completed -- meaning it has gone through all the phases that it needs to go through -- I want a trigger to fire up and change the contract status in the tblDeals table to "Completed" whose value is 1. When a new contract gets entered into the table, the Contract Status is set to 5 by default which means "In Progress" -- as defined in tblContractStatus. The tricky part is that because, each project is different and has different number of phases, the trigger has to make sure that all the phases have been submitted into the tblProduction table for that particular deal.

I'd really appreciate some help here. Thanks in advance for all your help.

---------------------------------------
Here's the script
---------------------------------------

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblDeals_tblCompany]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[tblDeals] DROP CONSTRAINT FK_tblDeals_tblCompany
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblDeals_tblContractStatus]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[tblDeals] DROP CONSTRAINT FK_tblDeals_tblContractStatus
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblDeals_tblPhaseType]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[tblDeals] DROP CONSTRAINT FK_tblDeals_tblPhaseType
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblPhase_tblPhaseType]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[tblPhase] DROP CONSTRAINT FK_tblPhase_tblPhaseType
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblProduction_tblDeals]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[tblProduction] DROP CONSTRAINT FK_tblProduction_tblDeals
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblProduction_tblPhase]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[tblProduction] DROP CONSTRAINT FK_tblProduction_tblPhase
GO

/****** Object: Table [dbo].[tblProduction] Script Date: 11/20/2003 11:30:48 AM ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblProduction]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tblProduction]
GO

/****** Object: Table [dbo].[tblDeals] Script Date: 11/20/2003 11:30:48 AM ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblDeals]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tblDeals]
GO

/****** Object: Table [dbo].[tblPhase] Script Date: 11/20/2003 11:30:48 AM ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblPhase]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tblPhase]
GO

/****** Object: Table [dbo].[tblCompany] Script Date: 11/20/2003 11:30:48 AM ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblCompany]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tblCompany]
GO

/****** Object: Table [dbo].[tblContractStatus] Script Date: 11/20/2003 11:30:48 AM ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblContractStatus]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tblContractStatus]
GO

/****** Object: Table [dbo].[tblPhaseType] Script Date: 11/20/2003 11:30:48 AM ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblPhaseType]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tblPhaseType]
GO

/****** Object: Table [dbo].[tblCompany] Script Date: 11/20/2003 11:30:50 AM ******/
CREATE TABLE [dbo].[tblCompany] (
[CompanyID] [int] IDENTITY (1, 1) NOT NULL ,
[CompanyName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO

/****** Object: Table [dbo].[tblContractStatus] Script Date: 11/20/2003 11:30:50 AM ******/
CREATE TABLE [dbo].[tblContractStatus] (
[StatusID] [tinyint] IDENTITY (1, 1) NOT NULL ,
[Status] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO

/****** Object: Table [dbo].[tblPhaseType] Script Date: 11/20/2003 11:30:51 AM ******/
CREATE TABLE [dbo].[tblPhaseType] (
[PhaseTypeID] [tinyint] IDENTITY (1, 1) NOT NULL ,
[Desription] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO

/****** Object: Table [dbo].[tblDeals] Script Date: 11/20/2003 11:30:51 AM ******/
CREATE TABLE [dbo].[tblDeals] (
[DealID] [int] IDENTITY (1, 1) NOT NULL ,
[CompanyID] [int] NOT NULL ,
[DealDate] [smalldatetime] NOT NULL ,
[PhaseTypeID] [tinyint] NOT NULL ,
[CashAmount] [smallmoney] NOT NULL ,
[StatusID] [tinyint] NOT NULL
) ON [PRIMARY]
GO

/****** Object: Table [dbo].[tblPhase] Script Date: 11/20/2003 11:30:52 AM ******/
CREATE TABLE [dbo].[tblPhase] (
[PhaseID] [tinyint] IDENTITY (1, 1) NOT NULL ,
[PhaseTypeID] [tinyint] NOT NULL ,
[PhaseDescription] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[PhasePercentage] [float] NOT NULL
) ON [PRIMARY]
GO

/****** Object: Table [dbo].[tblProduction] Script Date: 11/20/2003 11:30:52 AM ******/
CREATE TABLE [dbo].[tblProduction] (
[TransactionID] [int] IDENTITY (1, 1) NOT NULL ,
[DealID] [int] NOT NULL ,
[PhaseID] [tinyint] NOT NULL ,
[TransactionTimeStamp] [smalldatetime] NOT NULL ,
[Comments] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[tblCompany] WITH NOCHECK ADD
CONSTRAINT [PK_tblCompany] PRIMARY KEY CLUSTERED
(
[CompanyID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[tblContractStatus] WITH NOCHECK ADD
CONSTRAINT [PK_tblContractStatus] PRIMARY KEY CLUSTERED
(
[StatusID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[tblPhaseType] WITH NOCHECK ADD
CONSTRAINT [PK_tblPhaseType] PRIMARY KEY CLUSTERED
(
[PhaseTypeID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[tblDeals] WITH NOCHECK ADD
CONSTRAINT [PK_tblDeals] PRIMARY KEY CLUSTERED
(
[DealID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[tblPhase] WITH NOCHECK ADD
CONSTRAINT [PK_tblPhase] PRIMARY KEY CLUSTERED
(
[PhaseID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[tblProduction] WITH NOCHECK ADD
CONSTRAINT [PK_tblProduction] PRIMARY KEY CLUSTERED
(
[TransactionID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[tblDeals] ADD
CONSTRAINT [DF_tblDeals_StatusID] DEFAULT (5) FOR [StatusID]
GO

ALTER TABLE [dbo].[tblProduction] ADD
CONSTRAINT [DF_tblProduction_TransactionTimeStamp] DEFAULT (getdate()) FOR [TransactionTimeStamp]
GO

ALTER TABLE [dbo].[tblDeals] ADD
CONSTRAINT [FK_tblDeals_tblCompany] FOREIGN KEY
(
[CompanyID]
) REFERENCES [dbo].[tblCompany] (
[CompanyID]
),
CONSTRAINT [FK_tblDeals_tblContractStatus] FOREIGN KEY
(
[StatusID]
) REFERENCES [dbo].[tblContractStatus] (
[StatusID]
),
CONSTRAINT [FK_tblDeals_tblPhaseType] FOREIGN KEY
(
[PhaseTypeID]
) REFERENCES [dbo].[tblPhaseType] (
[PhaseTypeID]
)
GO

ALTER TABLE [dbo].[tblPhase] ADD
CONSTRAINT [FK_tblPhase_tblPhaseType] FOREIGN KEY
(
[PhaseTypeID]
) REFERENCES [dbo].[tblPhaseType] (
[PhaseTypeID]
)
GO

ALTER TABLE [dbo].[tblProduction] ADD
CONSTRAINT [FK_tblProduction_tblDeals] FOREIGN KEY
(
[DealID]
) REFERENCES [dbo].[tblDeals] (
[DealID]
),
CONSTRAINT [FK_tblProduction_tblPhase] FOREIGN KEY
(
[PhaseID]
) REFERENCES [dbo].[tblPhase] (
[PhaseID]
)
GO


exec sp_addextendedproperty N'MS_Description', N'Identifier', N'user', N'dbo', N'table', N'tblContractStatus', N'column', N'StatusID'
GO
exec sp_addextendedproperty N'MS_Description', N'Description', N'user', N'dbo', N'table', N'tblContractStatus', N'column', N'Status'


GO


exec sp_addextendedproperty N'MS_Description', N'Determines the type of phase structure this deal will go through', N'user', N'dbo', N'table', N'tblDeals', N'column', N'PhaseTypeID'
GO
exec sp_addextendedproperty N'MS_Description', N'Identifies the current status of deal', N'user', N'dbo', N'table', N'tblDeals', N'column', N'StatusID'


GO


exec sp_addextendedproperty N'MS_Description', N'Determines the percentage value of the phase', N'user', N'dbo', N'table', N'tblPhase', N'column', N'PhasePercentage'


GO


exec sp_addextendedproperty N'MS_Description', null, N'user', N'dbo', N'table', N'tblProduction', N'column', N'TransactionTimeStamp'


GO



---------------------------------------
And here's some data
---------------------------------------

INSERT INTO [tblPhaseType] ([Desription])VALUES('TV Commercial - 4 Phases')
INSERT INTO [tblPhaseType] ([Desription])VALUES('Full Campaign - 6 Phases')


INSERT INTO [tblPhase] ([PhaseTypeID],[PhaseDescription],[PhasePercentage])VALUES(1,'Customer Info',1.500000000000000e-001)
INSERT INTO [tblPhase] ([PhaseTypeID],[PhaseDescription],[PhasePercentage])VALUES(1,'Write script',2.500000000000000e-001)
INSERT INTO [tblPhase] ([PhaseTypeID],[PhaseDescription],[PhasePercentage])VALUES(1,'Shoot',3.500000000000000e-001)
INSERT INTO [tblPhase] ([PhaseTypeID],[PhaseDescription],[PhasePercentage])VALUES(1,'Edit commercial',2.500000000000000e-001)
INSERT INTO [tblPhase] ([PhaseTypeID],[PhaseDescription],[PhasePercentage])VALUES(2,'Customer info',1.500000000000000e-001)
INSERT INTO [tblPhase] ([PhaseTypeID],[PhaseDescription],[PhasePercentage])VALUES(2,'Write script',1.500000000000000e-001)
INSERT INTO [tblPhase] ([PhaseTypeID],[PhaseDescription],[PhasePercentage])VALUES(2,'Design print ad',1.500000000000000e-001)
INSERT INTO [tblPhase] ([PhaseTypeID],[PhaseDescription],[PhasePercentage])VALUES(2,'Shoot',1.500000000000000e-001)
INSERT INTO [tblPhase] ([PhaseTypeID],[PhaseDescription],[PhasePercentage])VALUES(2,'Edit',2.000000000000000e-001)
INSERT INTO [tblPhase] ([PhaseTypeID],[PhaseDescription],[PhasePercentage])VALUES(2,'Publish',2.000000000000000e-001)


INSERT INTO [tblContractStatus] ([Status])VALUES('Completed')
INSERT INTO [tblContractStatus] ([Status])VALUES('Hold')
INSERT INTO [tblContractStatus] ([Status])VALUES('Collections')
INSERT INTO [tblContractStatus] ([Status])VALUES('Legal')
INSERT INTO [tblContractStatus] ([Status])VALUES('In Progress')


INSERT INTO [tblCompany] ([CompanyName])VALUES('Johnny''s Remodeling')
INSERT INTO [tblCompany] ([CompanyName])VALUES('Perfect Cut Lawncare')
INSERT INTO [tblCompany] ([CompanyName])VALUES('Useless Ideas Unlimited')
INSERT INTO [tblCompany] ([CompanyName])VALUES('Try-It-Again, Inc.')


INSERT INTO [tblDeals] ([CompanyID],[DealDate],[PhaseTypeID],[CashAmount],[StatusID])VALUES(1,'Aug 5 2003 12:00:00:000AM',1,120.0000,5)
INSERT INTO [tblDeals] ([CompanyID],[DealDate],[PhaseTypeID],[CashAmount],[StatusID])VALUES(2,'Sep 9 2003 12:00:00:000AM',2,150.0000,5)
INSERT INTO [tblDeals] ([CompanyID],[DealDate],[PhaseTypeID],[CashAmount],[StatusID])VALUES(3,'Sep 10 2003 12:00:00:000AM',2,130.0000,5)
INSERT INTO [tblDeals] ([CompanyID],[DealDate],[PhaseTypeID],[CashAmount],[StatusID])VALUES(4,'Nov 20 2003 12:00:00:000AM',1,190.0000,5)


INSERT INTO [tblProduction] ([DealID],[PhaseID],[TransactionTimeStamp],[Comments])VALUES(1,1,'Nov 10 2003 10:23:00:000AM','Received company logo')
INSERT INTO [tblProduction] ([DealID],[PhaseID],[TransactionTimeStamp],[Comments])VALUES(1,2,'Nov 10 2003 10:23:00:000AM','Finished writing script')
INSERT INTO [tblProduction] ([DealID],[PhaseID],[TransactionTimeStamp],[Comments])VALUES(2,5,'Nov 10 2003 10:23:00:000AM','Just received company info')
INSERT INTO [tblProduction] ([DealID],[PhaseID],[TransactionTimeStamp],[Comments])VALUES(2,7,'Nov 10 2003 10:24:00:000AM','Finished designing ad copy')
INSERT INTO [tblProduction] ([DealID],[PhaseID],[TransactionTimeStamp],[Comments])VALUES(1,3,'Nov 20 2003 11:29:00:000AM','Did more work')
INSERT INTO [tblProduction] ([DealID],[PhaseID],[TransactionTimeStamp],[Comments])VALUES(1,4,'Nov 20 2003 11:29:00:000AM','Finally finished the job')

View 3 Replies View Related

Request Help Writing A Simple Trigger!

Feb 26, 2008

Experts: Please assist with coding a trigger for a SQL Server 2005 .NET application.

Here's the scenario:

Suppose there are tables MEMBERS, ACTIVITY, and HEADCOUNT that look like this:

MEMBER
member_id (int)
member_name (varchar(50))
...etc

ACTIVITY
activity_id (int)
activity_name (varchar(50))
...etc

HEADCOUNT
headcount_id (int)
member_id (int)
activity_id (int)
...etc

Suppose also that the ACTIVITY table is already populated with several records, say with activity_id = 1, 2, and 3.

OBJECTIVE: When a new member record is added to MEMBER, say member_id 10, insert one record in the HEADCOUNT table for EACH activity in ACTIVITY for that member. Thus, if member #10 is added to MEMBER, then the trigger (or some other mechanism) would add the following records to HEADCOUNT (which, say, already has 30 records):

headcount_id member_id activity_id
31 10 1
32 10 2
33 10 3

I've been advised that a trigger should do the trick for this, but as I'm totally new to SQL, I'll need some help. I'm guessing some iterating SQL command language might be required, but as I'm new to SQL, I don't know how to proceed.

Note that I'm building an ASP.NET application based on VB, and so records will be added to MEMBER through a tableadapter INSERT command. (Though I suspect this has no bearing on trigger behavior.)

Much obliged for your assistance.

-Kurt Euler
San Jose, CA

View 8 Replies View Related

Writing Trigger To Insert Records Into Master And Child Table At A Time ?

Oct 17, 2007

I am developing an application in vb.net 2005 using SQL Server 2000.
In this I have two tables SessionMaster and SessionChild.
Fields of session master - SessionMastId, Start_Date, End_Date, Session_Type,
Fields of session child - SessionChildId, SessionMastId, UserName, Comment.
SessionMastId and SessionChildId are primary keys of respective tables and also they are auto increment fields.
Please how to write trigger to insert record into both tables at a time.

View 2 Replies View Related

SQL 2000 On Dynamic Disks

Mar 21, 2002

Are there any issues with installing SQL 2000 on a server with Dynamic Disks configured with RAID 1 Mirroring ? I know that with Dynamic Disks there are no partitions but rather volumes. Is the drive configuration setup the same way ?. Would I setup a volume for the O/S and a volume for SQL ? The reason I need to use Dynamic Disks is because we will be integrating it later with an EMC SAN solution.

View 1 Replies View Related

Dynamic Vs Basic Disks

Oct 26, 2007



Can both be used with SQL server ? Dynamic disks provide more flexibility, is there performance imact ?
Thank you.

View 1 Replies View Related

Replace Cluster Disks

Apr 17, 2007

Hello,



I have a two node SQL 2000 cluster running on windows 2003 enterprise server. We need to replace the SAN disks. Can we not disable SQL service & Cluster service, copy the contents from existing disks to target disks, swap the drive letter & start the services?



What is the best practice to do this? Appreciate your help.



Thanks
Rajan

View 3 Replies View Related

Setting Up The Hard Disks

Nov 8, 2007

I have a new server.

It was shipped with a 76 gig drive setup in RAID 1 (2 disk) and a 400 gig drive setup in RAID 5 (4 disk).

I would like to determine what is the best way to setup up the partitions. What size and what should be placed on each.

Like the C: Drive...Should I just put Windows on there and nothing else? Do I stand to gain something from not using part of that 76 gigs as a D: drive for my apps?

View 1 Replies View Related

SQL 2012 :: AlwaysOn With Clustered Disks

Mar 13, 2014

I am trying to build the 2 node 2 clusters with the AlwaysOn.

Here isthe landscape.

2 nodes PROD failover cluster (running once instance)
2 nodes DR failover cluster (running 2 instances - DR and PRE-PROD)

Both clusters are in different geographies.

PRE-PROD can be editable. So out of scope of Always On.

One instance on PROD -> DR of the other box. [Want to achive thru AlwaysON]

Now my Question:

1) Do i need to have all the 4 nodes in same failover cluster group? If yes, then this would become MultiSubnet cluster Or Is there any way those 2 diffrerent failover clusters (one DR and one PROD) can be part of AlwaysOn.

2) Can i use the clustered disks as in the above landscape for always on?

View 1 Replies View Related

Database Snapshot On SAN Attached Disks

Sep 27, 2007

Hi All

I am in process of moving a SQL 2005 solution from a development box that used local storage to UAT environment with SAN attached storage. The solution uses database snapshots

The database files are on the SAN storage but during testing I was unable to create a Database snapshot on the SAN disk. Creating snapshots on the local disk worked fine.

Is their some restriction/problem in using the database snapshot technology with SAN storage?

View 19 Replies View Related

Placing Joined Tables On Separate Disks

Apr 7, 2008

I've read that if particular tables are frequently queried together through a join then these tables should be placed on different devices on different physical disks.
What does this mean exactly and how would you configure this?
Is this a common practice in high-performance real-world environments (or should it be)?
 

View 3 Replies View Related

Could Not Find Enough Space On Disks To Extend Database

Mar 2, 2005

Hello,

I am managing a sqlserver 6.5 database in my company. I get the message that the datafiles should be expanded but whenever I try to expand it the following message appears:

Could not find enough space on disks to extend the database. Meanwhile, I have about 6 gigabytes free space on my disks. Please help me out.
Thanks,

Albert

View 2 Replies View Related

SQL 2012 :: Making Mounted Disks Available On A Cluster?

May 12, 2015

OS Windows Server 2012
SQL 2012

I have a software that presents a drive to a 2 node cluster.

Not sure how I would go about presenting this newly presented drive as a Cluster Resource and make SQL depend on this resource.

View 5 Replies View Related

SQL 2012 :: Read And Write Speeds Not Increased With Additional Disks

Mar 13, 2014

Why I see absolutely no performance improvement when I spread my primary file group over 8 separate files on 8 separate disks, as opposed to having the primary file group all in one file on one disk.

I have set up 2 identical databases, one spread over 8 disks and one on one disk. Each database has a table called DATA and a column called VALUE. Value is NVARCHAR(200). I have filled each table up in both databases with 20,000 rows.

I then perform a select on each table in each database using CHECKPOINT and DBCC DROPCLEANBUFFERS to ensure I am reading from disk before each query and the execution times are identical in both databases.

I then ran the same queries against each database using a load testing tool and the batch requests per second on each DB is identical under load.

Surely the database with data spread over 8 disks should be FAR faster than the single file database as you have the combined reading power of 8 disks as opposed to 2??

Also, the same is happening for write speeds. When I create the data on both databases, the time it takes is identical on both.

BOL says it should be faster with multiple disks.

Just FYI this is on an Azure virtual machine and each disk is a locally redundant data disk that I have attached to the virtual machine.

Whether write speeds should increase with multiple disks or just read speeds?

View 8 Replies View Related

SQL 2012 :: No Disks Were Found On Which To Perform Cluster Validation Tests

Sep 9, 2014

I am getting following errors in my Cluster Validation report when trying to create a Windows Cluster.

I have 2 nodes DB01 and DB02 . Each has 1 public ip, 1 private ip (for heartbeat), 2 private ips for SAN1 and SAN2. The private ip's to SAN are directly connected via Network Adaptor in DB01 and DB02.

Validate Microsoft MPIO-based disks
Description: Validate that disks that use Microsoft Multipath I/O (MPIO) have been configured correctly.
Start: 9/9/2014 1:57:52 PM.
No disks were found on which to perform cluster validation tests.
Stop: 9/9/2014 1:57:53 PM.

[Code] ...

View 9 Replies View Related

SQL 2012 :: Disk / RAID Setup With Limited Disks For Windows 2008 R2

Jun 27, 2015

I am wondering what would be the best disk/RAID setup for a Windows server 2008 R2 OS and SQL Server 2012 database that has heavy read/write. I have the following disks I can use:

4x 15k 146GB
2x 10k 600GB

According to the server build requirements for the application, I need 100GB for the OS and 290GB for the drive containing the SQL mdf there are no stated requirements for the ldf, but would like to know if it should be allocated elsewhere?I should do RAID 10 for the 15k drives for SQL and RAID 1 for the OS on the 10k.

View 6 Replies View Related

SQL 2012 :: Blank Database Created On Two Separate Disks - Write To Multiple Files

Mar 17, 2014

I am testing out a blank database created over two physical files on two separate disks with one table called data which has one column called values nvarchar(max).

I filled the table up with a whole load of data and ran a select * against it. If I run Permon at the same time I can see that the read load has been spread over multiple disks as each of these disks is getting read from in parallel. If I create the same database on a single file and run the same select * again it takes much longer, proving that the read load has been distributed across multiple disks.

Now moving onto writes, this is where the confusion lies. I understand that SQL server fills files evenly until they need growing, after which it will then fill files individually until they are full in a round robin fashion unless you have trace 1117 turned on. What I don't understand is why the writes aren't distributed out whilst it is filling these file groups.

I ran an continual insert into my table with go 1000000 to monitor how the files are being filled up. I monitored where SQL server was physically placing the files as they were being inserted by running the following query:

;WITH CTE AS
(SELECT
sys.fn_PhysLocFormatter (%%physloc%%) col1,
RIGHT(LEFT(sys.fn_PhysLocFormatter (%%physloc%%),2),1) AS [Physical RID],
DATAID

[Code] ....

I could see that it would a thousand or so records into file 1, then a thousand or so into file 2, then a thousand or so into file 1 etc etc. In another words it would hit one disk, then another disk, then back to disk one to fill the file evenly. Is there any way to make SQL Server distribute the writes out in parallel so that both disks are writing in tandem?

By the looks of it, multiple disks only scale reads, as with writes only one disk is ever written to at once which is annoying. Any way to harness the write power of multiple disks?

View 6 Replies View Related

Physical Files

Feb 29, 2008

hi,
I am new to this technology. can anyone pls help me.can anybody tell me what is physiacl file and source physiacl file wat are the attributes of physical file and source physical file.and how do we identify the uniqueness of a job.

View 1 Replies View Related

Combining Physical Files

Feb 28, 2001

Can anyone inform me how I would go about merging or combining 2 or more physical database files into 1. For example, suppose you have the following files out on your server:

c:mssql7datapubs_data1.mdf
c:mssql7datapubs_data2.ndf
c:mssql7datapubs_data3.ndf

but you only want

c:mssql7datapubs_data1.mdf

Is there any way to combine pubs_data2.ndf and pubs_data3.ndf into pubs_data1.mdf so you are only left with 1 database file called pubs_data1.mdf?

Thank you,

PJ

View 1 Replies View Related

Modify Physical File Name

Oct 27, 2003

I know how to modify the logical file name: ALTER DATABASE SATutorial
MODIFY FILE (NAME = Tutorial, NEWNAME = SATutorial_data)
GO

How would I modify the physical file name from (e.g.) Tutorial.mdf to SATutorial_data.mdf?

TIA...

Al

View 3 Replies View Related

SQL Server Physical Migration

Dec 20, 2004

Hi! I have an SQL server installation with a 6.5GB database online at a particular location. I need to move the Database to another location which is a 1000 Miles away.

I have an additional physical Server at the other location which I can use to Sync the database from the original location. Can anyone please guide me to the best strategy to sync the database from the original location to the new location with minimum downtime??

Any help would be greatly appreciated.

Thanks and Regards
Anish

View 2 Replies View Related

Bit Datatypes Physical Storage

Feb 15, 2005

Can anyone explain to me how a column defined with a "bit null" datatype is physically stored in MSSQL? Is it stored like a "tinyint null" physically? In other words, how many bytes on the row on the page does a "bit null" datatype consume (assuming a non-null value 0, or 1 is the current value).


Is there any good documentation about the physical storage layout for a data page?

Thanks -

View 13 Replies View Related

Physical RAM Stress Test

Nov 20, 2006

Hi,

I have a new server where 32GB of RAM is installed and I have user databases on this server.I am using SQL server 2000 Enterprise edition and Platform is Windows 2003 adv server, which supports upto 128GB of memory.

sp_configure 'awe enabled' is set to 1 and at OS level, AWE is enabled as well.

max server memory (MB) is 2147483647

I was doing some stress test on this server but memory usage doesn't go beyond 180MB....can someone suggest a test for physical RAM ?

How can I make sure that application will make full use of available physical memory?

Rgds
Wilson

View 6 Replies View Related

Migration From Physical Host To VM?

Jun 25, 2015

we have:

(1) one physical server :

OS : Windows Server 2003
Active Directory, DNS, DHCP, File Server, Print Server and SQL Server 2005

and we will install new (2) two server for High Availability with VMware vSphere (ESXi) 6.0

and we will have (2) two Virtual Machine :

1st VM :
OS : Windows Server 2012 R2
Active Directory, DNS, DHCP

2nd VM :
OS : Windows Server 2008 R2 (becaure SQL Server 2005 does not work with 2012 R2 link)
SQL Server 2005 Service Pack 3

My Question is : What is a safe method to Migrate Database's from Physical Host (Windows Server 2003) to 2nd VM ?

View 9 Replies View Related

Migration To Another Physical Location

Apr 4, 2008

I may be put on a project involving the migration of a SQL Server 2000 database from one physical location to another. I've never done something like this so any guidance would be appreciated.

My plan is to:
1. Backup the live database.
2. Do a restoration at the new location.
3. Set up transactional replication between the two databases.
4. Update records to point to the new db.

Are there any problems with doing it this way? Is there a better solution? I am trying to do this without any downtime, or as little as possible.

Thanks for any help.

View 8 Replies View Related

Alert For Physical Memory

May 6, 2008

Is there an alert for physical memory in SQL2K5? My requirement is - I should get an alert when the free space on a particular drive comes below a threshhold.

------------------------
I think, therefore I am - Rene Descartes

View 11 Replies View Related

Physical Path Of Sql Server Log

May 30, 2008

hi
where is save the folder of sql server logs ,error logs in sql server 2005

View 2 Replies View Related

Physical Memory Utilization

Feb 12, 2007

Environment: Win2003 SP1, 32 bit, SQL Server 2K5

My server has 16GB RM but it is using only 3GB. And I see my server is using 3GB of Virtual Memory, too. Why my physical memory is not being utilized? How can I increase Physical Memory usage and decrease VM usage?



Canada DBA

View 19 Replies View Related

Physical Disk Partitions

May 21, 2007

I just inherited a dev box, and need to do some performance analyzing on a 40 gig db for a client. Time is of the essence!

My question is that this dev box only has one disk partition (c: drive). Is it a huge deal that I don't have the db system files on one drive, with the data files on another, and tempdb on another,etc.....

View 1 Replies View Related

Changing Physical SQL Server

Jul 23, 2005

Hello all,We are in the process of upgrading our SQL physical server (with SS2k). Inthe process we will change the OS form NT4 to W2K. What is the best way tocopy all my databases and SQL logins, roles, jobs, alerts, etc. from myactual (old) SQL Server to my new one?Thanks for your time.Yannick

View 2 Replies View Related

SQL Server 7 Physical Storage

Jul 23, 2005

I need to bulk insert very large amount of data into several MSSQLtables.The first Data model definition used identities to mantain relationshipbetween those tables but we found that natural keys (compound) arebetter forbulk insert (there is no need to obtain the identity first)My question is, changing the identities to natural keys (in some tablesinorder of 4, 5 attributes) will enlarge my database storage?I think MSSQL implements relationships with pointers (or hashcodes), sothestorage size will be similar, right?Regards,

View 3 Replies View Related

Looking For Physical Design Suggestions...

Jul 20, 2005

I got a server that has a RAID-5 array partitioned into C: and D:drives (OS Win2K Adv. Server installed on C:). The server also has amapping to a NAS device using the latest protocols that trick thesystem into thinking the map is actually a local SCSII drive. That'sdrive X:.This server is used only for SQL, and contains an OLTP database thatsees a lot of use and is pretty heavily indexed.I am toying with the idea of centralizing my data storage on the NAS(data center network segment is 1-gigabit ethernet). So I wasthinking about putting my primary data file on the NAS (drive X:) andkeeping all tables there, creating a secondary data file on localRAID-5 (drive D:) and putting all non-clustered indexes there, as wellas keeping the tempdb there and specifying the sort in tempdb option.Log files would also remain on D:.If anyone can suggest a better scenario given the above setup - I'dlove to hear it. Much appreciated.Alexey Aksyonenko

View 3 Replies View Related

Transaction Log Physical Device

Mar 18, 2008

Are there any problems or issues with backing up a transaction log to a physical file with the ".bak" extension? We are having some trouble with are hourly trans log backups and I was wondering if this could be part of the problem. Tom.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved