Showing posts with label databases. Show all posts
Showing posts with label databases. Show all posts

Friday, March 30, 2012

PROS and CONS of seperate databases for CACHING...

I have a main database...for this large Web site...and Im wonderingwhat would be the PROS and CONS of using another database (located onthe same, or on another SQL Server). Im just thinking this would begood incase we ever needed to take some load off one of the servers.

Also, we will be integrating Community Server into this Web site. Ofcourse you know CS adds its own database objects which crowd up ourmain database objects.

We were thinking of giving CS its own database also; bad practice, or...it doesn't matter much?

Thank youIf for ASPSTATE, then a separate server (now or in the future) would improve scalability.

If you mean multiple instances of SQL Server on the same server box (SQL Server 2000 and 2005 standard and up), then it is not a good idea as there is an overhead (plus licensing cost).

If you mean multiple databases within the same SQL instance, then that is the way to go.|||multiple databases within the same instance of sql server if its on the same machine...

sort of like this...

BOX1-SQL1 (all in same instance of sql server)
caching db
state db
auditing db

BOX2-SQL2 (all in same instance of sql server)
web site db
forum db

So THATS the way to go? Eh?
|||bumpsql

Wednesday, March 28, 2012

Property Owner is not available for Database '[DTA_TaxMan]'. This property may not exist

I get the following error everytime I try to go to the properties of
one of my databases.
The help link was useless.
I am not sure what to do. I am the top level administrator to my
server.
===================================
Cannot show requested dialog.
===================================
Cannot show requested dialog. (SqlMgmt)
Program Location:
at
Microsoft.SqlServer.Management.SqlMgmt.DefaultLaun chFormHostedControlAllocator.AllocateDialog(XmlDoc ument
initializationXml, IServiceProvider dialogServiceProvider,
CDataContainer dc)
at
Microsoft.SqlServer.Management.SqlMgmt.DefaultLaun chFormHostedControlAllocator.Microsoft.SqlServer.M anagement.SqlMgmt.ILaunchFormHostedControlAllocato r.CreateDialog(XmlDocument
initializationXml, IServiceProvider dialogServiceProvider)
at
Microsoft.SqlServer.Management.SqlMgmt.LaunchForm. InitializeForm(XmlDocument
doc, IServiceProvider provider, ISqlControlCollection control)
at
Microsoft.SqlServer.Management.SqlMgmt.LaunchForm. .ctor(XmlDocument
doc, IServiceProvider provider)
at
Microsoft.SqlServer.Management.UI.VSIntegration.Ob jectExplorer.ToolsMenuItem.OnCreateAndShowForm(ISe rviceProvider
sp, XmlDocument doc)
at
Microsoft.SqlServer.Management.SqlMgmt.RunningForm sTable.RunningFormsTableImpl.ThreadStarter.StartTh read()
===================================
Property Owner is not available for Database '[DTA_TaxMan]'. This
property may not exist for this object, or may not be retrievable due
to insufficient access rights. (Microsoft.SqlServer.Smo)
For help, click:
[url]http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00. 2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo. ExceptionTemplates.PropertyCannotBeRetrievedExcept ionText&EvtID=Owner&LinkId=20476[/url]
Program Location:
at
Microsoft.SqlServer.Management.Smo.PropertyCollect ion.HandleNullValue(Int32
index)
at Microsoft.SqlServer.Management.Smo.Database.get_Ow ner()
at
Microsoft.SqlServer.Management.SqlManagerUI.Create DatabaseData.DatabasePrototype.DatabaseData..ctor( CDataContainer
context, String databaseName)
at
Microsoft.SqlServer.Management.SqlManagerUI.Create DatabaseData.DatabasePrototype.LoadDefinition(Stri ng
newName)
at
Microsoft.SqlServer.Management.SqlManagerUI.Create DatabaseData.DatabasePrototype..ctor(CDataContaine r
context)
at
Microsoft.SqlServer.Management.SqlManagerUI.DBProp Sheet..ctor(CDataContainer
context)
I have also signed back in with SA, and still having the same problem.
sql

Property Owner is not available for Database '[DTA_TaxMan]'. This property may not exist

I get the following error everytime I try to go to the properties of
one of my databases.
The help link was useless.
I am not sure what to do. I am the top level administrator to my
server.
===================================
Cannot show requested dialog.
===================================
Cannot show requested dialog. (SqlMgmt)
--
Program Location:
at
Microsoft.SqlServer.Management.SqlMgmt.DefaultLaunchFormHostedControlAllocator.AllocateDialog(XmlDocument
initializationXml, IServiceProvider dialogServiceProvider,
CDataContainer dc)
at
Microsoft.SqlServer.Management.SqlMgmt.DefaultLaunchFormHostedControlAllocator.Microsoft.SqlServer.Management.SqlMgmt.ILaunchFormHostedControlAllocator.CreateDialog(XmlDocument
initializationXml, IServiceProvider dialogServiceProvider)
at
Microsoft.SqlServer.Management.SqlMgmt.LaunchForm.InitializeForm(XmlDocument
doc, IServiceProvider provider, ISqlControlCollection control)
at
Microsoft.SqlServer.Management.SqlMgmt.LaunchForm..ctor(XmlDocument
doc, IServiceProvider provider)
at
Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ToolsMenuItem.OnCreateAndShowForm(IServiceProvider
sp, XmlDocument doc)
at
Microsoft.SqlServer.Management.SqlMgmt.RunningFormsTable.RunningFormsTableImpl.ThreadStarter.StartThread()
===================================
Property Owner is not available for Database '[DTA_TaxMan]'. This
property may not exist for this object, or may not be retrievable due
to insufficient access rights. (Microsoft.SqlServer.Smo)
--
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.PropertyCannotBeRetrievedExceptionText&EvtID=Owner&LinkId=20476
--
Program Location:
at
Microsoft.SqlServer.Management.Smo.PropertyCollection.HandleNullValue(Int32
index)
at Microsoft.SqlServer.Management.Smo.Database.get_Owner()
at
Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseData.DatabasePrototype.DatabaseData..ctor(CDataContainer
context, String databaseName)
at
Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseData.DatabasePrototype.LoadDefinition(String
newName)
at
Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseData.DatabasePrototype..ctor(CDataContainer
context)
at
Microsoft.SqlServer.Management.SqlManagerUI.DBPropSheet..ctor(CDataContainer
context)I have also signed back in with SA, and still having the same problem.

Monday, March 12, 2012

Programming databases

I need to create a database with one table and its column names.
I got this script from the query analyzer templates as a database basic template:
IF EXISTS (SELECT *
FROM master..sysdatabases
WHERE name = N'<database_name, sysname, test_db>')
DROP DATABASE <database_name, sysname, test_db>
GO

CREATE DATABASE <database_name, sysname, test_db>
GO

I am not sure what it all means, what I need to do it name the database a certain name each time. and then create one table with 6 column names.

can someone give me guidance please...the script is just trying to make sure there is no other db with that name and drop the db one if there is one..

hth|||Not really, heres what I got...


Declare @.name Char(10)
Set @.name = 'test'
CREATE DATABASE [@.name] ON (NAME = N'' & @.name & '_Data', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\data\' & @.name & '_Data.MDF' , SIZE = 2, FILEGROWTH = 10%) LOG ON (NAME = N'' & @.name & '_Log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\data\' & @.name & '_Log.LDF' , SIZE = 1, FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CI_AS
GO
exec sp_dboption N'@.name', N'autoclose', N'false'
GO

exec sp_dboption N'@.name', N'bulkcopy', N'false'
GO
and so on...

Getting the variable '@.name' to go where I want it is where my problem occurs|||its more like

CREATE DATABASE+ @.name+ ON (NAME = N'' ......

hth|||exec sp_dboption N'hol', N'read only', N'false'
GO

What I need to do is pass, from the web page, a variable called @.name
So where it shows N'hol', the variable passed from the web form textbox whould go where 'hol' is.
N'' + @.name + '', does not work. what is the proper sytax for this?

E|||I suspect you don't understand what the 'N' bit means? (sorry if I'm wrong) You could split the batch up and use proper params. Although I'm a tad concerned that a web users is allowed to issue such commands, but hey I'm sure you've taken care of the security aspect.|||absolutely, what I am trying to do is automate as much as possible. this will be a hidden command in which the user can maintain an image database just by naming it where the form pulls the name from a textbox. Administration only should have access to this sort of command, so its all good with security.
SO tell me more about this spliting the batch up and the use of proper param names you speak of.. No, I am not sure of what the 'N' bit means either. Can you help?|||Params are good because you can literally use
exec spbla @.myParam1, @.myParam2
and you won't have to worry about all the horrible string concat problems.

Lookup SQLParameter.
Plus if your command type is stored procedure you can call spblaa directly!

I think you'll have to split up the batch cause normally client exec'd code doesn't like the "GO"s, although I've not actually tried it with the ADO.net.

I'll whisper the following, you don't really need the 'N' bit. Its just saying that the text is going to be unicode. You rarely have to worry about that, certainly not for params (i.e you don't prefix a param with 'N'). I didn't say that ok ;)

Wednesday, March 7, 2012

Programmatically copy table structure?

I have been looking for a way to copy the table definition (column, identities, default constraints, etc) programmatically between databases.
I have tried 'select * into...' but that only copies column names, data types and nullibility.
sp_helptext does not have any data on table objects.

So, the only thing I can think of is to use DDL triggers to keep the tables in sync. But I would prefer a method where I could run a stored procedure with a table name and have it return the DDL to create that table.

Any help would be welcome.

-Preston M. Price
You should use a management API like SQL DMO/SMO instead of writing server side code. There is no built-in mechanism on the server-side to do scripting - you have to write your own code. DMO/SMO have objects to script schema easily but not changes comparing two tables for example. It is not clear if you require that functionality. For comparing objects and generating schema change scripts, you need to use 3rd party tools.|||I was working with SMO and DMO and they do what I want, but there is no way to include their functionality inside a CLR stored procedure.

So as far as I can tell there is no way to programmatically (T-SQL or CLR supported procedures) copy the complete structure of a table (with or without data) from inside SQL Server, this seems like a weakness to me.

-Preston M. Price

Saturday, February 25, 2012

Programmatic inspection of a dump?

I need to set up a job to allow users to restore their databases, on SQL Server 2000 SP3. The idea is that a user inserts a record into a table, identifying the dump they want to load. (They can only restore their own account.) A job picks up this record, restores the database, and notifies the user as appropriate.

My part of this is writing the procedure that the job executes, including the dump restore. Part of that is getting each dump's file groups (data, index, and log) into the proper locations for this server and this user.

Essentially, I need to be able to access the results of 'load filelistonly' from a cursor. How do I access the file list?Essentially, I need to be able to access the results of 'load filelistonly' from a cursor. How do I access the file list?
Google is your friend. http://www.karaszi.com/sqlserver/util_restore_all_in_file.asp|||Man .. its better if you do not call the backup a dump (You know what I mean !!!)... coz its what will save your A$$ when the database goes down ...