Tuesday, March 20, 2012
ASP - Insert Multiple records
Please explain some more!|||Well... i have a webpage in ASP. It displays all the ringing tones on the particular tones.asp page. Currently there is no check box as I do not know how to implement the method..
Therefore what i mean is that all the ringtones (to insert as new record in db), I have to view one by one to insert.
What i want to know is the way on how to mass insert all the ringtones with just a single click on the button. Meaning that i checked a few check boxes, and click the button..
You know what i mean my fren..?
Hope you can help..|||BTW, its sort of like the HOTMAIL... where you checked some boxes and PUT INTO FOLDER.... bla bla bla..
But what i want now is checked my ringtones check boxes and click a button to insert as a new record in my DB..|||<%
If len(trim(Request.Form("mTones"))) > 0 Then
Dim SQLStmt, x
SQLStmt = ""
for x = 1 to request.form("mTones").count
SQLStmt = SQLStmt & "INSERT INTO kek (tone) VALUES('"request.form("mTones")(x) & "';"
next
conn.execute(SQLStmt)
end if
%>
<form methos=post action=tones.asp>
<input type=checkbox name="mTones" id="tone1">tone1
<input type=checkbox name="mTones" id="tone2">tone2
<input type=submit>
</form>sql
Monday, March 19, 2012
ASCMD executing multiple MDX commands in one batch file
Has anyone got an example of ASCMD executing multiple MDX commands in one batch file? Or are we restricted to one MDX command only? We haven't been able to use multiple commands.
The doc at http://msdn2.microsoft.com/en-us/library/ms186692.aspx states that you can have multiple xmla commands.
<Command> <Batch Transaction="Boolean" ProcessAffectedObjects="Boolean"> <Bindings>...</Bindings> <DataSource>...</DataSource> <DataSourceView>...</DataSourceView> <ErrorConfiguration>...</ErrorConfiguration> <Parallel>...</Parallel> <!-- One or more XMLA commands --> </Batch> </Command>
I think ascmd is already sending through the <Command> element, so you only need to pass it the elements under that. If you put the following into a text file and pass it into ascmd, it will execute 2 create commands, creating two empty databases called Test Database 1 and Test Database 2.
<Batch Transaction="false" ProcessAffectedObjects="false" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Create>
<ObjectDefinition>
<Database xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>Test Database 1</Name>
<Description>A test database.</Description>
</Database>
</ObjectDefinition>
</Create>
<Create>
<ObjectDefinition>
<Database xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>Test Database 2</Name>
<Description>A test database.</Description>
</Database>
</ObjectDefinition>
</Create>
</Batch>
|||
You cannot have multiple MDX commands in your batch. Batch is intended for execution of several processing commands not MDX.
I believe next version of ASCMD will support GO statement. So you'd be able to create an input file with several MDX statements separated by the GO. Very much the same way it is done in SQL.
Edward Melomed.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Sorry contexbi, Edward is correct BOL is inaccurate. I read "MDX Command", but I was thinking "XMLA Command" when I first answered your question.
As you may know MDX statements are sent in a "Statement" element and you cannot have more than 1 of these in an XMLA command/batch. Other commands (like my create example) can be batched up, but until BOL is fixed you can't really tell which ones until you try. I believe that the restriction on only allowing a single MDX statement is a security feature to prevent potential "MDX injection" attacks.
Management Studio does implement the "GO" statement to execute multiple MDX statements, but this is because it breaks up and sends the MDX separately but I don't think you can get SSMS to run unattended.
Your only approach at the moment would be to call ascmd multiple times from a batch file.
|||Thanks for the update and clarification. The documentation was confusing.
Any ETA for the next version of ASCMD that supports multiple MDX statements in a batch? SP2?
|||Hello,
Can we process the partitions and dimensions in one xmla file?
The reason I ask is that we will use the parallel tag to process the dimensions in parallel. But how do I ensure that the partition/ measure group is processed after the dimensions in a single XMLA script?
Rgds
HariK
You can definitely have dimensions and partitions in a single batch command.
Analysis Server will analyzes every object involved in processing and builds a processing schedule the way dimensions are processed first.
Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
ASCMD executing multiple MDX commands in one batch file
Has anyone got an example of ASCMD executing multiple MDX commands in one batch file? Or are we restricted to one MDX command only? We haven't been able to use multiple commands.
The doc at http://msdn2.microsoft.com/en-us/library/ms186692.aspx states that you can have multiple xmla commands.
<Command> <Batch Transaction="Boolean" ProcessAffectedObjects="Boolean"> <Bindings>...</Bindings> <DataSource>...</DataSource> <DataSourceView>...</DataSourceView> <ErrorConfiguration>...</ErrorConfiguration> <Parallel>...</Parallel> <!-- One or more XMLA commands --> </Batch> </Command>
I think ascmd is already sending through the <Command> element, so you only need to pass it the elements under that. If you put the following into a text file and pass it into ascmd, it will execute 2 create commands, creating two empty databases called Test Database 1 and Test Database 2.
<Batch Transaction="false" ProcessAffectedObjects="false" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Create>
<ObjectDefinition>
<Database xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>Test Database 1</Name>
<Description>A test database.</Description>
</Database>
</ObjectDefinition>
</Create>
<Create>
<ObjectDefinition>
<Database xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>Test Database 2</Name>
<Description>A test database.</Description>
</Database>
</ObjectDefinition>
</Create>
</Batch>
|||
You cannot have multiple MDX commands in your batch. Batch is intended for execution of several processing commands not MDX.
I believe next version of ASCMD will support GO statement. So you'd be able to create an input file with several MDX statements separated by the GO. Very much the same way it is done in SQL.
Edward Melomed.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Sorry contexbi, Edward is correct BOL is inaccurate. I read "MDX Command", but I was thinking "XMLA Command" when I first answered your question.
As you may know MDX statements are sent in a "Statement" element and you cannot have more than 1 of these in an XMLA command/batch. Other commands (like my create example) can be batched up, but until BOL is fixed you can't really tell which ones until you try. I believe that the restriction on only allowing a single MDX statement is a security feature to prevent potential "MDX injection" attacks.
Management Studio does implement the "GO" statement to execute multiple MDX statements, but this is because it breaks up and sends the MDX separately but I don't think you can get SSMS to run unattended.
Your only approach at the moment would be to call ascmd multiple times from a batch file.
|||Thanks for the update and clarification. The documentation was confusing.
Any ETA for the next version of ASCMD that supports multiple MDX statements in a batch? SP2?
|||Hello,
Can we process the partitions and dimensions in one xmla file?
The reason I ask is that we will use the parallel tag to process the dimensions in parallel. But how do I ensure that the partition/ measure group is processed after the dimensions in a single XMLA script?
Rgds
HariK
You can definitely have dimensions and partitions in a single batch command.
Analysis Server will analyzes every object involved in processing and builds a processing schedule the way dimensions are processed first.
Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Saturday, February 25, 2012
AS 2005 modeling question
We have three fact-tables with a classic hierarchical order:
-customer table
-order table
-order positions
one customer has multiple orders and one order has multiple order positions
and we have one dimension articles related to the position table.
Further we defined a count measure for each measure group.
The question is how can we connect the articles dimension (related to order positions measure group) to the customer measure group to get a count over customers? We tried to use m:n relations. It was not very fast (10 million fact rows).
Any ideas to model this 1:n scenario fast and clever ;-)?
Thanks in advance
Ole J.
I am not sure about what you mean about the customers table being a fact table. That is a dimension table. Perhaps you can explain further?
Next. In the order postions table you will only have to add the order number and the customer number to that fact table as keys like this:
-CustomerKey
-OrderKey
-OrderItemKey
-Measure.
You will do this in the ETL-process with SSIS(Integration services) when you load your fact table.
Your mistake is perhaps that you have separated orders and order line items in two different fact tables?
HTH
Thomas Ivarsson
|||Thanks Thomas for your first ideas. I would like to tell you a little bit more background.The customer table is indeed a fact table because there are for example measures like lifetime-values and others... and further the focus of investigation is not only the customer name but the count of customers is more important.
The vision is to have a customer measure group with at least one measure customer count and one or more dimensions like customer sex or others...
And with order facts we want to analyze the count of orders (facts), the amount group (dimension) and so on.
Line items are interesting because of the count over line items, a dimension that filters some properties of the line items and further more.
Is it really necessary to join the tables before we build the cube? We thought that in AS2005 we can simply bring together the measure groups?
What we have done so far is we denormelized the tables in the following way:
Customer table:
CustomerID, CustomerSexID
Order table:
OrderID, AmountGroupID, CustomerID, CustomerSexID
OrderItems table:
OrderItemsID, OrderitemsDimensionID, OrderID, AmountGroupID, CustomerID, CustomerSexID
In BI Studio it looks like this:
MeasureGroup MeasureGroup MeasureGroup
Customer Order OrderItems
Dimension
CustomerSex X X X
OrderAmountGroup X X
OrderItemsDimension X
So if you anaylize rigth now the dimension CustomerSex you get the correct results for:
count customer
count order
count orderitems
But if you want to analyze the OrderItemsDimension you get only the correct results for the count OrderItems because of the fact that until now the Orders and Customers measure group are not related to the dimension OrderItemsDimension. So the question is how can you go the way back from the count orderitems to get a result for the orders or customer counts?
I hope you can now better imagine what i mean..? Any ideas?
Thanks in advance,
Ole J.|||Any ideas?
Thanks in advance!
Ole J.|||
Hello Ole. This looks like a complicated project. I am unable to see the complete picture of what you would like to do.
I am not sure if your best choice is to do data mining, build a cube or combine these approaches.
My recommendation is to have a look att www.Kimball.group and see if there is any design tips that can help you.
You can also have a look here(http://www.sqlserverdatamining.com)
In SSAS2005 the customer sex is an attribute within the customer dimension so I do not understand why you will build this as a single dimension.
Regards
Thomas Ivarsson
|||If I understand the situation, you already have CustomerSex as a reference dimension in the OrderItems measure group and you just want to control the behavior of the values in the Cutomer and Order measure groups when a order item is specified in the query. (The cube wizard should create this design for you if you specify each of the three tables as both fact and dimension tables.) Try using the IgnoreUnrelatedDimensions property on the measure groups (see http://msdn2.microsoft.com/en-us/library/microsoft.analysisservices.measuregroup.ignoreunrelateddimensions.aspx).
Hope this helps
Sunday, February 19, 2012
Arranging data on multiple rows into a sigle row (converting rows into columns)
Hello,
I have a survey (30 questions) application in a SQL server db. The application uses several relational tables. The results are arranged so that each answer is on a seperate row:
user1 answer1
user1 answer2
user1 answer3
user2 answer1
user2 answer2
user2 answer3
For statistical analysis I need to transfer the results to an Excel spreadsheet (for later use in SPSS). In the spreadsheet I need the results to appear so thateach user will be on a single row with all of that user's answers on that single row (A column for each answer):
user1 answer1 answer2 answer3
user2 answer1 answer2 answer3
How can this be done? How can all answers of a user appear on a single row
Thanx,
Danny.
sql server 2005 or 2000?
In sql server 2005, I believe the answer is with the new pivot or unpivot commands. In 2000, it gets much trickier.
Of course, I think excel can do it's own pivoting as well.
Thursday, February 9, 2012
Are seperate databases betters?
This approach is contrary to typical hosted DB designs that I have delt with -- that is, a single database holding multiple customer information rather than a unique database for each customer.
Does the improved security of a dedicated database out-weigh the additional maintenance requirements?
If anyone has some objective thoughts on this topic, I'd love to hear them.
Thanks,
BillIf this is a "hosted" application for, say, a cadre of retail stores each one of which has its own block of customers, products, sales, etc to deal with, then the stores are the hosting-company's "customers."
Each store expects to see and to deal with only its own set of information, and considers that information to be highly proprietary.
The hosting-company will have, ex minimis, a warehouseman's fiduciary duty with respect to the information, extending not only to the stores but indirectly to their customers. I think that having separate databases, with separate login-IDs etc, is really the only scenario that would work.|||It really depends on the requirements - Do the customers need to have additional isolation(security/fault tolerance/performance) ? How much data will be stored for each customer and what data will be maintained ?|||Thanks for the replies.
[The hosting-company will have, ex minimis, a warehouseman's fiduciary duty with respect to the information, extending not only to the stores but indirectly to their customers...]
Even with a single database, reasonable precautions are taken. All customers have separate logins and distinct logical segregation of data. The approach is roughly analogous to a bank safe with safe boxes holding the possessions of multiple parties.
[It really depends on the requirements - Do the customers need to have additional isolation(security/fault tolerance/performance) ? How much data will be stored for each customer and what data will be maintained ?]
I think if you were to ask any given customer, their knee-jerk reaction would be to say that they want their own database. But other than the fear of co-mingling of data, there are no specific scale or performance reasons that would demand it.
My concern with separate databases is the administrative overhead if you have a thousand customers, youd have a thousand databases. Things like Schema updates, index rebuilds, etc. would become a significant activity.|||My biggest worry would be if someone from company A deletes half their data. After the restore, company B asks "Where is my data from today". Just my .02 USD.|||Originally posted by billdavidheiser
[The hosting-company will have, ex minimis, a warehouseman's fiduciary duty with respect to the information, extending not only to the stores but indirectly to their customers...]
Even with a single database, reasonable precautions are taken. All customers have separate logins and distinct logical segregation of data. The approach is roughly analogous to a bank safe with safe boxes holding the possessions of multiple parties.
[It really depends on the requirements - Do the customers need to have additional isolation(security/fault tolerance/performance) ? How much data will be stored for each customer and what data will be maintained ?]
I think if you were to ask any given customer, their knee-jerk reaction would be to say that they want their own database. But other than the fear of co-mingling of data, there are no specific scale or performance reasons that would demand it.
My concern with separate databases is the administrative overhead if you have a thousand customers, youd have a thousand databases. Things like Schema updates, index rebuilds, etc. would become a significant activity.
As usual, what it really comes down to is: "it depends." Multiple databases make it less likely that the wrong customers' data will be visible but have their own negative implications as well. I think that the best advice, borne out by this little discussion, is that the designer must be keenly aware of the tradeoffs that will inevitably be made with any decision. Every decision is a compromise. No matter how forcibly a particular position may be argued on a forum ;) it is neither "right" nor "wrong."|||Multiple databases have the following advantages:
If one or some customers ask for his or their data backup you can easily do it.
If one or some customers ask for some changes which may be related to the table structures, you can easily handle it.
If one or some customers leave, you can easily backup and delete (drop) his or their databases without cleaning his or their data in one database.|||Originally posted by sundialsvcs
As usual, what it really comes down to is: "it depends." Multiple databases make it less likely that the wrong customers' data will be visible but have their own negative implications as well. I think that the best advice, borne out by this little discussion, is that the designer must be keenly aware of the tradeoffs that will inevitably be made with any decision. Every decision is a compromise. No matter how forcibly a particular position may be argued on a forum ;) it is neither "right" nor "wrong."
["it depends."]
Ah, very helpful. Thank you. Are you an Economics professor by any chance? :)
Seriously though; I understand what you are saying and agree. I was hoping to hear if anyone out there has a real-world experiance with trying to maintain a boat-load of individual customer databases.|||MCrowley brings up a good point which ties into fault tolerance. What happens if the database is suspect or part of it is corrupt - all of your users would be hosed if using 1 database.
What about the amount of data being stored per customer and the frequency of updates/deletes/inserts per customer ? Is the amount of data fixed per customer and do they infrequently change data ?|||The company that I'm working for has individual customer database for each customer. All databases have the same structure except some extra fields for some databases based on the customers requirements. We had some problems which happened to some of databases and the websites related to those databases were affected. In this case, individual customer database shows an advantage.
For the maintenance of the databases, since they have almost same structure you can use a script to do a job for all databases. I think that the advantages are much more than disadvantages.
Are multiple transaction logs used concurrently or sequentially?
mapped drive, but I read in one post here that SQL Server considers
all transaction logs to be one big log file. Is this true?
Is there any way to have redundant transaction logs without mirroring>
Hi,
No, SQL Server allows to create multiple Transaction logs for a database.
Eg: from books online:-
USE master
GO
CREATE DATABASE Archive
ON
PRIMARY ( NAME = Arch1,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archdat1.mdf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Arch2,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archdat2.ndf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Arch3,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archdat3.ndf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20)
LOG ON
( NAME = Archlog1,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archlog1.ldf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Archlog2,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archlog2.ldf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20)
GO
Thanks
Hari
SQL Server MVP
"fumanchu" <leondobr@.verizon.net> wrote in message
news:rjvtn0tjdv3afv74bv33t3k9ueng4fg7ml@.4ax.com...
> It'd be nice to have redundant transaction logs, maybe even one on a
> mapped drive, but I read in one post here that SQL Server considers
> all transaction logs to be one big log file. Is this true?
> Is there any way to have redundant transaction logs without mirroring>
|||On Tue, 26 Oct 2004 21:03:37 -0500, "Hari Prasad"
<hari_prasad_k@.hotmail.com> wrote:
>Hi,
>No, SQL Server allows to create multiple Transaction logs for a database.
>
I understand that you can have multiple transaction logs, but are they
concurrent, that is, interchangeable copies of one another, or are
they used one after another as continuation files?
|||Hi,
They are interchangable.Check out the section "Transaction Log Physical
Architecture" in the SQL
Server Books Online.
Thanks
Hari
"fumanchu" <leondobr@.verizon.net> wrote in message
news:ii1un0h1o0tnk7s3ndmb66oc8v3nv7jb2j@.4ax.com...
> On Tue, 26 Oct 2004 21:03:37 -0500, "Hari Prasad"
> <hari_prasad_k@.hotmail.com> wrote:
>
> I understand that you can have multiple transaction logs, but are they
> concurrent, that is, interchangeable copies of one another, or are
> they used one after another as continuation files?
|||The logs are all in use, you would use multiple logs across multiple RAID
sets to gain better performance, say you had 3 log files, data would be
striped across all 3.
I sort of see what you might want to do what you ask, you could achieve this
by doing log shipping, but, the interval between log dumps would be your
potentially non-recovery window.
You could also look at clustering.
Tony Rogerson
SQL Server MVP
http://www.sqlserverfaq.com?mbr=21
(Create your own groups, Forum, FAQ's and a ton more)
|||The way the SQL Logs work is sequential... Even if you have 5 logs, SQL is
only using one at a time, writing serially to the end of the file... So
having multiple files does not improve performance.
Mirroring is probably the best way to get redundancy on the logs, and it is
a best practice that I suspect most people follow.
There is some file mirroring software out there ( I can't remember the
company ) that keeps files in sync real-time, and they claim this works with
SQL as well...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"fumanchu" <leondobr@.verizon.net> wrote in message
news:rjvtn0tjdv3afv74bv33t3k9ueng4fg7ml@.4ax.com...
> It'd be nice to have redundant transaction logs, maybe even one on a
> mapped drive, but I read in one post here that SQL Server considers
> all transaction logs to be one big log file. Is this true?
> Is there any way to have redundant transaction logs without mirroring>
|||Hi Wayne,
If the database has multiple logs they are written to (striped) at the same
time - so, if you put them on the same logical disk they will grow together.
For example, if you create a database (see below) with 2 log files and write
a big table onto it, both log files will grow together, in my own test here
they both ended up 39MB.
The biggest problem here is that its striping (essentially RAID 0) so no
fault tolerance, if you put the logs on seperate drives and one goes then
you lose the log.
CREATE DATABASE testlog
ON PRIMARY
( NAME = testdb1,
FILENAME = N'e:\testlog1.mdf',
SIZE = 10MB,
MAXSIZE = 200MB,
FILEGROWTH = 10%)
LOG ON
( NAME = testlog1,
FILENAME = N'h:\testlog1.ldf',
SIZE = 512KB,
MAXSIZE = 200MB,
FILEGROWTH = 10%),
( NAME = testlog2,
FILENAME = N'h:\testlog2.ldf',
SIZE = 512KB,
MAXSIZE = 200MB,
FILEGROWTH = 10%)
GO
Tony.
Tony Rogerson
SQL Server MVP
http://www.sqlserverfaq.com?mbr=21
(Create your own groups, Forum, FAQ's and a ton more)
|||Tony,
I think the question is about performance, and I have a feeling that SQL Server will not write
concurrently to these log files. AFAIK, SQL Server will grow one file (with z number of VLF's) fill
that, then grow the other file and fill that etc. I don't know HW enough to determine whether we
still could gain anything by having multiple log files, but assuming a simple install with one log
file per physical disk, I would assume that only one disk would be hit at a time.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Tony Rogerson" <tonyrogerson@.sqlserver.eu.com> wrote in message
news:ezYBooCvEHA.568@.TK2MSFTNGP09.phx.gbl...
> Hi Wayne,
> If the database has multiple logs they are written to (striped) at the same time - so, if you put
> them on the same logical disk they will grow together.
> For example, if you create a database (see below) with 2 log files and write a big table onto it,
> both log files will grow together, in my own test here they both ended up 39MB.
> The biggest problem here is that its striping (essentially RAID 0) so no fault tolerance, if you
> put the logs on seperate drives and one goes then you lose the log.
> CREATE DATABASE testlog
> ON PRIMARY
> ( NAME = testdb1,
> FILENAME = N'e:\testlog1.mdf',
> SIZE = 10MB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%)
> LOG ON
> ( NAME = testlog1,
> FILENAME = N'h:\testlog1.ldf',
> SIZE = 512KB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%),
> ( NAME = testlog2,
> FILENAME = N'h:\testlog2.ldf',
> SIZE = 512KB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%)
> GO
> Tony.
> --
> Tony Rogerson
> SQL Server MVP
> http://www.sqlserverfaq.com?mbr=21
> (Create your own groups, Forum, FAQ's and a ton more)
>
|||Hi Tibor,
Nope - try the example, SQL Server stripes across the 2 log files! It does
the same for multiple data files in a file group as well.
Create a database using the create db below and do something like this (from
a big table in another db)...
select *
into mytest
from yourotherdb..bigtable
where 1 = 0
go
insert mytest
select *
from yourotherdb..bigtable
Observe that the two log files end up the same size, in fact, watch them
grow - they grow at the same rate.
When multiple log (or data files) for a single db are placed on different
logical disks, the proportion of data striped to each file is dependant on
how much free space there is on the drives where they reside.
CREATE DATABASE testlog
ON PRIMARY
( NAME = testdb1,
FILENAME = N'e:\testlog1.mdf',
SIZE = 10MB,
MAXSIZE = 200MB,
FILEGROWTH = 10%)
LOG ON
( NAME = testlog1,
FILENAME = N'h:\testlog1.ldf',
SIZE = 512KB,
MAXSIZE = 200MB,
FILEGROWTH = 10%),
( NAME = testlog2,
FILENAME = N'h:\testlog2.ldf',
SIZE = 512KB,
MAXSIZE = 200MB,
FILEGROWTH = 10%)
Tony Rogerson
SQL Server MVP
http://www.sqlserverfaq.com?mbr=21
(Create your own groups, Forum, FAQ's and a ton more)
|||Hi Tony
I think we're not talking about growing the physical files, but how existing
log files are filled. Your script shows that once the log files have reached
their initially created size, then new space is allocated for each of them
in a striped fashion.
But, if you change your script to initially create your log files with some
reasonable size, and then use dbcc loginfo to examine them as the insert is
taking place, you will see that one of them gets filled completely before
the other one starts to be filled.
HTH
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Tony Rogerson" <tonyrogerson@.sqlserver.eu.com> wrote in message
news:%23YSfShEvEHA.2540@.TK2MSFTNGP09.phx.gbl...
> Hi Tibor,
> Nope - try the example, SQL Server stripes across the 2 log files! It does
> the same for multiple data files in a file group as well.
> Create a database using the create db below and do something like this
> (from a big table in another db)...
> select *
> into mytest
> from yourotherdb..bigtable
> where 1 = 0
> go
> insert mytest
> select *
> from yourotherdb..bigtable
> Observe that the two log files end up the same size, in fact, watch them
> grow - they grow at the same rate.
> When multiple log (or data files) for a single db are placed on different
> logical disks, the proportion of data striped to each file is dependant on
> how much free space there is on the drives where they reside.
> CREATE DATABASE testlog
> ON PRIMARY
> ( NAME = testdb1,
> FILENAME = N'e:\testlog1.mdf',
> SIZE = 10MB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%)
> LOG ON
> ( NAME = testlog1,
> FILENAME = N'h:\testlog1.ldf',
> SIZE = 512KB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%),
> ( NAME = testlog2,
> FILENAME = N'h:\testlog2.ldf',
> SIZE = 512KB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%)
> --
> Tony Rogerson
> SQL Server MVP
> http://www.sqlserverfaq.com?mbr=21
> (Create your own groups, Forum, FAQ's and a ton more)
>
Are multiple transaction logs used concurrently or sequentially?
mapped drive, but I read in one post here that SQL Server considers
all transaction logs to be one big log file. Is this true?
Is there any way to have redundant transaction logs without mirroring>Hi,
No, SQL Server allows to create multiple Transaction logs for a database.
Eg: from books online:-
USE master
GO
CREATE DATABASE Archive
ON
PRIMARY ( NAME = Arch1,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archdat1.mdf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Arch2,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archdat2.ndf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Arch3,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archdat3.ndf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20)
LOG ON
( NAME = Archlog1,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archlog1.ldf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Archlog2,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archlog2.ldf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20)
GO
Thanks
Hari
SQL Server MVP
"fumanchu" <leondobr@.verizon.net> wrote in message
news:rjvtn0tjdv3afv74bv33t3k9ueng4fg7ml@.4ax.com...
> It'd be nice to have redundant transaction logs, maybe even one on a
> mapped drive, but I read in one post here that SQL Server considers
> all transaction logs to be one big log file. Is this true?
> Is there any way to have redundant transaction logs without mirroring>|||On Tue, 26 Oct 2004 21:03:37 -0500, "Hari Prasad"
<hari_prasad_k@.hotmail.com> wrote:
>Hi,
>No, SQL Server allows to create multiple Transaction logs for a database.
>
I understand that you can have multiple transaction logs, but are they
concurrent, that is, interchangeable copies of one another, or are
they used one after another as continuation files?|||Hi,
They are interchangable.Check out the section "Transaction Log Physical
Architecture" in the SQL
Server Books Online.
Thanks
Hari
"fumanchu" <leondobr@.verizon.net> wrote in message
news:ii1un0h1o0tnk7s3ndmb66oc8v3nv7jb2j@.4ax.com...
> On Tue, 26 Oct 2004 21:03:37 -0500, "Hari Prasad"
> <hari_prasad_k@.hotmail.com> wrote:
>>Hi,
>>No, SQL Server allows to create multiple Transaction logs for a database.
> I understand that you can have multiple transaction logs, but are they
> concurrent, that is, interchangeable copies of one another, or are
> they used one after another as continuation files?|||The logs are all in use, you would use multiple logs across multiple RAID
sets to gain better performance, say you had 3 log files, data would be
striped across all 3.
I sort of see what you might want to do what you ask, you could achieve this
by doing log shipping, but, the interval between log dumps would be your
potentially non-recovery window.
You could also look at clustering.
--
Tony Rogerson
SQL Server MVP
http://www.sqlserverfaq.com?mbr=21
(Create your own groups, Forum, FAQ's and a ton more)|||The way the SQL Logs work is sequential... Even if you have 5 logs, SQL is
only using one at a time, writing serially to the end of the file... So
having multiple files does not improve performance.
Mirroring is probably the best way to get redundancy on the logs, and it is
a best practice that I suspect most people follow.
There is some file mirroring software out there ( I can't remember the
company ) that keeps files in sync real-time, and they claim this works with
SQL as well...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"fumanchu" <leondobr@.verizon.net> wrote in message
news:rjvtn0tjdv3afv74bv33t3k9ueng4fg7ml@.4ax.com...
> It'd be nice to have redundant transaction logs, maybe even one on a
> mapped drive, but I read in one post here that SQL Server considers
> all transaction logs to be one big log file. Is this true?
> Is there any way to have redundant transaction logs without mirroring>|||Hi Wayne,
If the database has multiple logs they are written to (striped) at the same
time - so, if you put them on the same logical disk they will grow together.
For example, if you create a database (see below) with 2 log files and write
a big table onto it, both log files will grow together, in my own test here
they both ended up 39MB.
The biggest problem here is that its striping (essentially RAID 0) so no
fault tolerance, if you put the logs on seperate drives and one goes then
you lose the log.
CREATE DATABASE testlog
ON PRIMARY
( NAME = testdb1,
FILENAME = N'e:\testlog1.mdf',
SIZE = 10MB,
MAXSIZE = 200MB,
FILEGROWTH = 10%)
LOG ON
( NAME = testlog1,
FILENAME = N'h:\testlog1.ldf',
SIZE = 512KB,
MAXSIZE = 200MB,
FILEGROWTH = 10%),
( NAME = testlog2,
FILENAME = N'h:\testlog2.ldf',
SIZE = 512KB,
MAXSIZE = 200MB,
FILEGROWTH = 10%)
GO
Tony.
--
Tony Rogerson
SQL Server MVP
http://www.sqlserverfaq.com?mbr=21
(Create your own groups, Forum, FAQ's and a ton more)|||Tony,
I think the question is about performance, and I have a feeling that SQL Server will not write
concurrently to these log files. AFAIK, SQL Server will grow one file (with z number of VLF's) fill
that, then grow the other file and fill that etc. I don't know HW enough to determine whether we
still could gain anything by having multiple log files, but assuming a simple install with one log
file per physical disk, I would assume that only one disk would be hit at a time.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Tony Rogerson" <tonyrogerson@.sqlserver.eu.com> wrote in message
news:ezYBooCvEHA.568@.TK2MSFTNGP09.phx.gbl...
> Hi Wayne,
> If the database has multiple logs they are written to (striped) at the same time - so, if you put
> them on the same logical disk they will grow together.
> For example, if you create a database (see below) with 2 log files and write a big table onto it,
> both log files will grow together, in my own test here they both ended up 39MB.
> The biggest problem here is that its striping (essentially RAID 0) so no fault tolerance, if you
> put the logs on seperate drives and one goes then you lose the log.
> CREATE DATABASE testlog
> ON PRIMARY
> ( NAME = testdb1,
> FILENAME = N'e:\testlog1.mdf',
> SIZE = 10MB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%)
> LOG ON
> ( NAME = testlog1,
> FILENAME = N'h:\testlog1.ldf',
> SIZE = 512KB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%),
> ( NAME = testlog2,
> FILENAME = N'h:\testlog2.ldf',
> SIZE = 512KB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%)
> GO
> Tony.
> --
> Tony Rogerson
> SQL Server MVP
> http://www.sqlserverfaq.com?mbr=21
> (Create your own groups, Forum, FAQ's and a ton more)
>|||Hi Tibor,
Nope - try the example, SQL Server stripes across the 2 log files! It does
the same for multiple data files in a file group as well.
Create a database using the create db below and do something like this (from
a big table in another db)...
select *
into mytest
from yourotherdb..bigtable
where 1 = 0
go
insert mytest
select *
from yourotherdb..bigtable
Observe that the two log files end up the same size, in fact, watch them
grow - they grow at the same rate.
When multiple log (or data files) for a single db are placed on different
logical disks, the proportion of data striped to each file is dependant on
how much free space there is on the drives where they reside.
CREATE DATABASE testlog
ON PRIMARY
( NAME = testdb1,
FILENAME = N'e:\testlog1.mdf',
SIZE = 10MB,
MAXSIZE = 200MB,
FILEGROWTH = 10%)
LOG ON
( NAME = testlog1,
FILENAME = N'h:\testlog1.ldf',
SIZE = 512KB,
MAXSIZE = 200MB,
FILEGROWTH = 10%),
( NAME = testlog2,
FILENAME = N'h:\testlog2.ldf',
SIZE = 512KB,
MAXSIZE = 200MB,
FILEGROWTH = 10%)
--
Tony Rogerson
SQL Server MVP
http://www.sqlserverfaq.com?mbr=21
(Create your own groups, Forum, FAQ's and a ton more)|||Hi Tony
I think we're not talking about growing the physical files, but how existing
log files are filled. Your script shows that once the log files have reached
their initially created size, then new space is allocated for each of them
in a striped fashion.
But, if you change your script to initially create your log files with some
reasonable size, and then use dbcc loginfo to examine them as the insert is
taking place, you will see that one of them gets filled completely before
the other one starts to be filled.
--
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Tony Rogerson" <tonyrogerson@.sqlserver.eu.com> wrote in message
news:%23YSfShEvEHA.2540@.TK2MSFTNGP09.phx.gbl...
> Hi Tibor,
> Nope - try the example, SQL Server stripes across the 2 log files! It does
> the same for multiple data files in a file group as well.
> Create a database using the create db below and do something like this
> (from a big table in another db)...
> select *
> into mytest
> from yourotherdb..bigtable
> where 1 = 0
> go
> insert mytest
> select *
> from yourotherdb..bigtable
> Observe that the two log files end up the same size, in fact, watch them
> grow - they grow at the same rate.
> When multiple log (or data files) for a single db are placed on different
> logical disks, the proportion of data striped to each file is dependant on
> how much free space there is on the drives where they reside.
> CREATE DATABASE testlog
> ON PRIMARY
> ( NAME = testdb1,
> FILENAME = N'e:\testlog1.mdf',
> SIZE = 10MB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%)
> LOG ON
> ( NAME = testlog1,
> FILENAME = N'h:\testlog1.ldf',
> SIZE = 512KB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%),
> ( NAME = testlog2,
> FILENAME = N'h:\testlog2.ldf',
> SIZE = 512KB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%)
> --
> Tony Rogerson
> SQL Server MVP
> http://www.sqlserverfaq.com?mbr=21
> (Create your own groups, Forum, FAQ's and a ton more)
>|||Sorry Kalen, didn't read the entire post.
I see that the first file is written to then it works from top to bottom on
the second file filling that first and then the first file until filled.
The allocation of space is done to both, which makes sense.
Sorry Wayne/Tibor !
Tony.
--
Tony Rogerson
SQL Server MVP
http://www.sqlserverfaq.com?mbr=21
(Create your own groups, Forum, FAQ's and a ton more)
Are multiple transaction logs used concurrently or sequentially?
mapped drive, but I read in one post here that SQL Server considers
all transaction logs to be one big log file. Is this true?
Is there any way to have redundant transaction logs without mirroring>Hi,
No, SQL Server allows to create multiple Transaction logs for a database.
Eg: from books online:-
USE master
GO
CREATE DATABASE Archive
ON
PRIMARY ( NAME = Arch1,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archdat1.mdf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Arch2,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archdat2.ndf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Arch3,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archdat3.ndf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20)
LOG ON
( NAME = Archlog1,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archlog1.ldf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Archlog2,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\archlog2.ldf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20)
GO
Thanks
Hari
SQL Server MVP
"fumanchu" <leondobr@.verizon.net> wrote in message
news:rjvtn0tjdv3afv74bv33t3k9ueng4fg7ml@.
4ax.com...
> It'd be nice to have redundant transaction logs, maybe even one on a
> mapped drive, but I read in one post here that SQL Server considers
> all transaction logs to be one big log file. Is this true?
> Is there any way to have redundant transaction logs without mirroring>|||On Tue, 26 Oct 2004 21:03:37 -0500, "Hari Prasad"
<hari_prasad_k@.hotmail.com> wrote:
>Hi,
>No, SQL Server allows to create multiple Transaction logs for a database.
>
I understand that you can have multiple transaction logs, but are they
concurrent, that is, interchangeable copies of one another, or are
they used one after another as continuation files?|||Hi,
They are interchangable.Check out the section "Transaction Log Physical
Architecture" in the SQL
Server Books Online.
Thanks
Hari
"fumanchu" <leondobr@.verizon.net> wrote in message
news:ii1un0h1o0tnk7s3ndmb66oc8v3nv7jb2j@.
4ax.com...
> On Tue, 26 Oct 2004 21:03:37 -0500, "Hari Prasad"
> <hari_prasad_k@.hotmail.com> wrote:
>
> I understand that you can have multiple transaction logs, but are they
> concurrent, that is, interchangeable copies of one another, or are
> they used one after another as continuation files?|||The logs are all in use, you would use multiple logs across multiple RAID
sets to gain better performance, say you had 3 log files, data would be
striped across all 3.
I sort of see what you might want to do what you ask, you could achieve this
by doing log shipping, but, the interval between log dumps would be your
potentially non-recovery window.
You could also look at clustering.
Tony Rogerson
SQL Server MVP
http://www.sqlserverfaq.com?mbr=21
(Create your own groups, Forum, FAQ's and a ton more)|||The way the SQL Logs work is sequential... Even if you have 5 logs, SQL is
only using one at a time, writing serially to the end of the file... So
having multiple files does not improve performance.
Mirroring is probably the best way to get redundancy on the logs, and it is
a best practice that I suspect most people follow.
There is some file mirroring software out there ( I can't remember the
company ) that keeps files in sync real-time, and they claim this works with
SQL as well...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"fumanchu" <leondobr@.verizon.net> wrote in message
news:rjvtn0tjdv3afv74bv33t3k9ueng4fg7ml@.
4ax.com...
> It'd be nice to have redundant transaction logs, maybe even one on a
> mapped drive, but I read in one post here that SQL Server considers
> all transaction logs to be one big log file. Is this true?
> Is there any way to have redundant transaction logs without mirroring>|||Hi Wayne,
If the database has multiple logs they are written to (striped) at the same
time - so, if you put them on the same logical disk they will grow together.
For example, if you create a database (see below) with 2 log files and write
a big table onto it, both log files will grow together, in my own test here
they both ended up 39MB.
The biggest problem here is that its striping (essentially RAID 0) so no
fault tolerance, if you put the logs on seperate drives and one goes then
you lose the log.
CREATE DATABASE testlog
ON PRIMARY
( NAME = testdb1,
FILENAME = N'e:\testlog1.mdf',
SIZE = 10MB,
MAXSIZE = 200MB,
FILEGROWTH = 10%)
LOG ON
( NAME = testlog1,
FILENAME = N'h:\testlog1.ldf',
SIZE = 512KB,
MAXSIZE = 200MB,
FILEGROWTH = 10%),
( NAME = testlog2,
FILENAME = N'h:\testlog2.ldf',
SIZE = 512KB,
MAXSIZE = 200MB,
FILEGROWTH = 10%)
GO
Tony.
Tony Rogerson
SQL Server MVP
http://www.sqlserverfaq.com?mbr=21
(Create your own groups, Forum, FAQ's and a ton more)|||Tony,
I think the question is about performance, and I have a feeling that SQL Ser
ver will not write
concurrently to these log files. AFAIK, SQL Server will grow one file (with
z number of VLF's) fill
that, then grow the other file and fill that etc. I don't know HW enough to
determine whether we
still could gain anything by having multiple log files, but assuming a simpl
e install with one log
file per physical disk, I would assume that only one disk would be hit at a
time.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Tony Rogerson" <tonyrogerson@.sqlserver.eu.com> wrote in message
news:ezYBooCvEHA.568@.TK2MSFTNGP09.phx.gbl...
> Hi Wayne,
> If the database has multiple logs they are written to (striped) at the sam
e time - so, if you put
> them on the same logical disk they will grow together.
> For example, if you create a database (see below) with 2 log files and wri
te a big table onto it,
> both log files will grow together, in my own test here they both ended up
39MB.
> The biggest problem here is that its striping (essentially RAID 0) so no f
ault tolerance, if you
> put the logs on seperate drives and one goes then you lose the log.
> CREATE DATABASE testlog
> ON PRIMARY
> ( NAME = testdb1,
> FILENAME = N'e:\testlog1.mdf',
> SIZE = 10MB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%)
> LOG ON
> ( NAME = testlog1,
> FILENAME = N'h:\testlog1.ldf',
> SIZE = 512KB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%),
> ( NAME = testlog2,
> FILENAME = N'h:\testlog2.ldf',
> SIZE = 512KB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%)
> GO
> Tony.
> --
> Tony Rogerson
> SQL Server MVP
> http://www.sqlserverfaq.com?mbr=21
> (Create your own groups, Forum, FAQ's and a ton more)
>|||Hi Tibor,
Nope - try the example, SQL Server stripes across the 2 log files! It does
the same for multiple data files in a file group as well.
Create a database using the create db below and do something like this (from
a big table in another db)...
select *
into mytest
from yourotherdb..bigtable
where 1 = 0
go
insert mytest
select *
from yourotherdb..bigtable
Observe that the two log files end up the same size, in fact, watch them
grow - they grow at the same rate.
When multiple log (or data files) for a single db are placed on different
logical disks, the proportion of data striped to each file is dependant on
how much free space there is on the drives where they reside.
CREATE DATABASE testlog
ON PRIMARY
( NAME = testdb1,
FILENAME = N'e:\testlog1.mdf',
SIZE = 10MB,
MAXSIZE = 200MB,
FILEGROWTH = 10%)
LOG ON
( NAME = testlog1,
FILENAME = N'h:\testlog1.ldf',
SIZE = 512KB,
MAXSIZE = 200MB,
FILEGROWTH = 10%),
( NAME = testlog2,
FILENAME = N'h:\testlog2.ldf',
SIZE = 512KB,
MAXSIZE = 200MB,
FILEGROWTH = 10%)
Tony Rogerson
SQL Server MVP
http://www.sqlserverfaq.com?mbr=21
(Create your own groups, Forum, FAQ's and a ton more)|||Hi Tony
I think we're not talking about growing the physical files, but how existing
log files are filled. Your script shows that once the log files have reached
their initially created size, then new space is allocated for each of them
in a striped fashion.
But, if you change your script to initially create your log files with some
reasonable size, and then use dbcc loginfo to examine them as the insert is
taking place, you will see that one of them gets filled completely before
the other one starts to be filled.
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Tony Rogerson" <tonyrogerson@.sqlserver.eu.com> wrote in message
news:%23YSfShEvEHA.2540@.TK2MSFTNGP09.phx.gbl...
> Hi Tibor,
> Nope - try the example, SQL Server stripes across the 2 log files! It does
> the same for multiple data files in a file group as well.
> Create a database using the create db below and do something like this
> (from a big table in another db)...
> select *
> into mytest
> from yourotherdb..bigtable
> where 1 = 0
> go
> insert mytest
> select *
> from yourotherdb..bigtable
> Observe that the two log files end up the same size, in fact, watch them
> grow - they grow at the same rate.
> When multiple log (or data files) for a single db are placed on different
> logical disks, the proportion of data striped to each file is dependant on
> how much free space there is on the drives where they reside.
> CREATE DATABASE testlog
> ON PRIMARY
> ( NAME = testdb1,
> FILENAME = N'e:\testlog1.mdf',
> SIZE = 10MB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%)
> LOG ON
> ( NAME = testlog1,
> FILENAME = N'h:\testlog1.ldf',
> SIZE = 512KB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%),
> ( NAME = testlog2,
> FILENAME = N'h:\testlog2.ldf',
> SIZE = 512KB,
> MAXSIZE = 200MB,
> FILEGROWTH = 10%)
> --
> Tony Rogerson
> SQL Server MVP
> http://www.sqlserverfaq.com?mbr=21
> (Create your own groups, Forum, FAQ's and a ton more)
>