Showing posts with label program. Show all posts
Showing posts with label program. Show all posts

Thursday, March 29, 2012

Automating the creation of a database

Hi;
We have a program (ASP.NET) that requires a database as it's back end. We
are trying to create an install that requires as little expertise as
possible. In other words, no DBA required.
For creating the database itself we are at that point. We use the registry
to find the location of osql.exe and use that to run the schema that creates
the database. I'ld prefer an API we could call so we can more cleanly handle
errors but this works fine 98% of the time.
The remaining problem is ownership of the created database.
1) Is there a way (in .NET 2.0) to query if the database is mixed mode
authentication.
2) And if it is a way to both get a list of all users
3) And to create a user?
We can already enum all domain users. So with the above we could give them a
list of all users they can choose from as the owner and also let then create
a new one - without the user ever having to run any SqlServer tool or even
have any installed.
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm> The remaining problem is ownership of the created database.
> 1) Is there a way (in .NET 2.0) to query if the database is mixed mode
> authentication.
It is SERVER property not a databases
SELECT SERVERPROPERTY('IsIntegratedSecurityOnly
') AS
[IsIntegratedSecurityOnly]

> 2) And if it is a way to both get a list of all users
EXEC northwind..sp_helpuser

> 3) And to create a user?
Create Database mydb
go
use mydb
go
sp_addlogin 'mydbuser','monitor','mydb'
go
sp_adduser 'mydbuser'
go
sp_Addrolemember 'db_datawriter','mydbuser'
go
sp_Addrolemember 'db_datareader','mydbuser'
go
"David Thielen" <thielen@.nospam.nospam> wrote in message
news:25882AC6-F4EF-422A-8B68-63ABE75AACF3@.microsoft.com...
> Hi;
> We have a program (ASP.NET) that requires a database as it's back end. We
> are trying to create an install that requires as little expertise as
> possible. In other words, no DBA required.
> For creating the database itself we are at that point. We use the registry
> to find the location of osql.exe and use that to run the schema that
> creates
> the database. I'ld prefer an API we could call so we can more cleanly
> handle
> errors but this works fine 98% of the time.
> The remaining problem is ownership of the created database.
> 1) Is there a way (in .NET 2.0) to query if the database is mixed mode
> authentication.
> 2) And if it is a way to both get a list of all users
> 3) And to create a user?
> We can already enum all domain users. So with the above we could give them
> a
> list of all users they can choose from as the owner and also let then
> create
> a new one - without the user ever having to run any SqlServer tool or even
> have any installed.
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
> Cubicle Wars - http://www.windwardreports.com/film.htm
>|||Hi David,
I am afraid that the database may have some synchronous problem now. Our
yesterday's replies cannot be seen from Web and we also cannot see your
replies.
So I post it again from Outlook Express and hope you could see it now. Sorry
for bringing you any inconvenience.
I understand that your application used osql.exe to create the database and
you have three questions on the ownership of the created database now:
1. How to query (in .NET 2.0) if the database is with mixed authentication
mode?
2. How to get a list of all users?
3. How to create a user?
If I have misunderstood, please let me know.
For your three questions and even your creating database function, you can
fully resolve the questions by using the SQL Server SMO component for .NET
2.0.
1. You can just create a Server object like this:
//Server Name
string strConn = "(local)";
//Instantiate SMO Server Object
Server svr = new Server(strConn);
Console.Writeline(svr.Settings.LoginMode.ToString());
2. To get the list of all users, you can use:
Database db = server.Databases["your_db_name"];
UserCollection users = db.Users;
3. To create a user, you can use:
//Instantiate SMO Login object
Login l = new Login(svr, loginName);
//If Login doesn't already exist
if (!svr.Logins.Contains(loginName))
{
//Login should be of type Sql Login
l.LoginType = LoginType.SqlLogin;
//Create the Login on the SQL Server with password: pa$$w0rd
l.Create("pa$$w0rd");
//Add the login to the sysadmin role
l.AddToRole("sysadmin");
}
//Instantiate a new database object
Database db = new Database(svr, "Fizoo2");
//Make SQL Server create the database
db.Create();
//Instantiate a new User object
User u = new User(db, "SQL_Login_user");
//associated it with the login "SQL_Login"
u.Login = loginName;
//Make SQL Server create the user
u.Create();
For more information, you can refer to the following references:
User Privileges View & Create User Tool
http://forums.microsoft.com/MSDN/Sh...840637&SiteID=1
How to: Create a Visual C# SMO Project in Visual Studio .NET
http://msdn2.microsoft.com/it-it/library/ms162129.aspx
How to: Modify SQL Server Settings in Visual Basic .NET
http://msdn2.microsoft.com/en-us/library/ms162131.aspx
If you have any other questions or concerns, please feel free to let me
know. It is my pleasure to be of assistance.
Sincerely yours,
Charles Wang
Microsoft Online Community Support
========================================
==============
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from this issue.
========================================
==============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============
"David Thielen" <thielen@.nospam.nospam> wrote in message
news:25882AC6-F4EF-422A-8B68-63ABE75AACF3@.microsoft.com...
> Hi;
> We have a program (ASP.NET) that requires a database as it's back end. We
> are trying to create an install that requires as little expertise as
> possible. In other words, no DBA required.
> For creating the database itself we are at that point. We use the registry
> to find the location of osql.exe and use that to run the schema that
> creates
> the database. I'ld prefer an API we could call so we can more cleanly
> handle
> errors but this works fine 98% of the time.
> The remaining problem is ownership of the created database.
> 1) Is there a way (in .NET 2.0) to query if the database is mixed mode
> authentication.
> 2) And if it is a way to both get a list of all users
> 3) And to create a user?
> We can already enum all domain users. So with the above we could give them
> a
> list of all users they can choose from as the owner and also let then
> create
> a new one - without the user ever having to run any SqlServer tool or even
> have any installed.
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
> Cubicle Wars - http://www.windwardreports.com/film.htm
>|||Hi Dave,
I understand that your application used osql.exe to create the database and
you have three questions on the ownership of the created database now:
1. How to query (in .NET 2.0) if the database is with mixed authentication
mode?
2. How to get a list of all users?
3. How to create a user?
If I have misunderstood, please let me know.
For your three questions and even your creating database function, you can
fully resolve the questions by using the SQL Server SMO component for .NET
2.0.
1. You can just create a Server object like this:
//Server Name
string strConn = "(local)";
//Instantiate SMO Server Object
Server svr = new Server(strConn);
Console.Writeline(svr.Settings.LoginMode.ToString());
2. To get the list of all users, you can use:
Database db = server.Databases["your_db_name"];
UserCollection users = db.Users;
3. To create a user, you can use:
//Instantiate SMO Login object
Login l = new Login(svr, loginName);
//If Login doesn't already exist
if (!svr.Logins.Contains(loginName))
{
//Login should be of type Sql Login
l.LoginType = LoginType.SqlLogin;
//Create the Login on the SQL Server with password: pa$$w0rd
l.Create("pa$$w0rd");
//Add the login to the sysadmin role
l.AddToRole("sysadmin");
}
//Instantiate a new database object
Database db = new Database(svr, "Fizoo2");
//Make SQL Server create the database
db.Create();
//Instantiate a new User object
User u = new User(db, "SQL_Login_user");
//associated it with the login "SQL_Login"
u.Login = loginName;
//Make SQL Server create the user
u.Create();
For more information, you can refer to the following references:
User Privileges View & Create User Tool
http://forums.microsoft.com/MSDN/Sh...840637&SiteID=1
How to: Create a Visual C# SMO Project in Visual Studio .NET
http://msdn2.microsoft.com/it-it/library/ms162129.aspx
How to: Modify SQL Server Settings in Visual Basic .NET
http://msdn2.microsoft.com/en-us/library/ms162131.aspx
If you have any other questions or concerns, please feel free to let me
know. It is my pleasure to be of assistance.
Sincerely yours,
Charles Wang
Microsoft Online Community Support
========================================
==============
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from this issue.
========================================
==============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============

Thursday, March 22, 2012

Automatically create ODBC connections

Hello everybody!

I'm using the 'Data Sources (ODBC)' program that comes with windows to
create the odbc connections I need. Although that is quite fast and easy I
would like to have it more automated, since I'm using the same parameters
all the time.
Can anybody tell me (or give pointers to) how that is done?

regards
--
Johnny LjunggrenJohnny Ljunggren <johnny@.navtek.no> wrote in message news:<pan.2004.08.18.07.59.24.480484@.navtek.no>...
> Hello everybody!
> I'm using the 'Data Sources (ODBC)' program that comes with windows to
> create the odbc connections I need. Although that is quite fast and easy I
> would like to have it more automated, since I'm using the same parameters
> all the time.
> Can anybody tell me (or give pointers to) how that is done?
> regards

This article (or one of the ones linked from it) might be useful:

http://support.microsoft.com/defaul...b;en-us;Q184608

If not, you should probably ask this in an ODBC group, since it's not
really an MSSQL question.

Simon|||Den Wed, 18 Aug 2004 07:13:16 -0700, skrev Simon Hayes:

>> I'm using the 'Data Sources (ODBC)' program that comes with windows to
>> create the odbc connections I need. Although that is quite fast and easy I
>> would like to have it more automated, since I'm using the same parameters
>> all the time.
>> Can anybody tell me (or give pointers to) how that is done?
> This article (or one of the ones linked from it) might be useful:
> http://support.microsoft.com/defaul...b;en-us;Q184608

Looks like this might solve my problem. Thanks a lot.

> If not, you should probably ask this in an ODBC group, since it's not
> really an MSSQL question.

I know, but my newsprovider doesn't have any odbc-groups, so I thought
this was close enough....

--
Johnny Ljunggren

automatically copy database to another pc

When I create a setup program for my vb.net 1.0 app which has embedded sql express database, it successfully copies the database to the new machine alone with the upgraded app.

However, if I just copy the vb.exe app to the other pc and also copy the mdf, ldf files, I get an error opening the sql database.

I am presuming that the setup program does some kind of backup restore or detach, attach to copy in the .mdf.

If the user cannot do this from the management studio (or if they do not have the management studio installed), is there any way I can create some method to have this copying done automatically via some code by the user?

Thanks

SM Haig

Yes, you can run a restore script using the sqlcmd program. You can read more about the restore command here:

http://msdn2.microsoft.com/en-us/library/ms186858.aspx

Buck Woody

Sunday, March 11, 2012

Automatic Backups

Hi:
Somebody knows how I can program a stored procedure for automatic backup to
disk in SQL Server 2005 checking the transaction log?
Thanks in advance
Ale In SQL Server Management Studio, Go to Management, Maintenance Plans, right
click the node and select New. Choose the "Back Up Database Task" option fro
m
the toolbox. Configure the backup wizard as needed.
AndyP,
Sr. Database Administrator,
MCDBA 2003
"Ale" wrote:

> Hi:
> Somebody knows how I can program a stored procedure for automatic backup t
o
> disk in SQL Server 2005 checking the transaction log?
> Thanks in advance
> Ale |||ok, I checked this but I have one doubt: how can I check my log? if I want
that my backup init when my log is at 80 %, how can I send an automatic form
the backup process to work? it exists a manner for programming this in SQL
Server 2005? (like a cron in UNIX)
Thanks again
Ale
"AndyP" wrote:
[vbcol=seagreen]
> In SQL Server Management Studio, Go to Management, Maintenance Plans, righ
t
> click the node and select New. Choose the "Back Up Database Task" option f
rom
> the toolbox. Configure the backup wizard as needed.
>
> --
> AndyP,
> Sr. Database Administrator,
> MCDBA 2003
>
> "Ale" wrote:
>|||You can create an Agent Performance Condition Alert that triggers on log ful
l percent and trigger
your job that does a backup of the log. If prefer to just schedule my backup
s regularly, though.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Ale" <Ale@.discussions.microsoft.com> wrote in message
news:02D8FBBD-0BB8-4514-B2D9-051E39DA18B0@.microsoft.com...[vbcol=seagreen]
> ok, I checked this but I have one doubt: how can I check my log? if I want
> that my backup init when my log is at 80 %, how can I send an automatic fo
rm
> the backup process to work? it exists a manner for programming this in SQL
> Server 2005? (like a cron in UNIX)
> Thanks again
> Ale
> "AndyP" wrote:
>|||Ok, I'll try it!
This Agent triggers when the condition is completed?
Thanks!
Ale
"Tibor Karaszi" wrote:

> You can create an Agent Performance Condition Alert that triggers on log f
ull percent and trigger
> your job that does a backup of the log. If prefer to just schedule my back
ups regularly, though.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Ale" <Ale@.discussions.microsoft.com> wrote in message
> news:02D8FBBD-0BB8-4514-B2D9-051E39DA18B0@.microsoft.com...
>
>|||> This Agent triggers when the condition is completed?
When the condition is true, yes. For instance, you can for the counter "Perc
ent log full" specify a
value "raises above" and 80. When that perf mon counter is > 80, the alert i
s fired.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Ale" <Ale@.discussions.microsoft.com> wrote in message
news:E8BD8E4E-C95C-4A01-903F-C91848F8BD52@.microsoft.com...[vbcol=seagreen]
> Ok, I'll try it!
> This Agent triggers when the condition is completed?
> Thanks!
> Ale
> "Tibor Karaszi" wrote:
>|||It′s working!
Thanks!!!
Ale
"Tibor Karaszi" wrote:

> When the condition is true, yes. For instance, you can for the counter "Pe
rcent log full" specify a
> value "raises above" and 80. When that perf mon counter is > 80, the alert
is fired.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Ale" <Ale@.discussions.microsoft.com> wrote in message
> news:E8BD8E4E-C95C-4A01-903F-C91848F8BD52@.microsoft.com...
> .
>

Automatic Backups

Hi:
Somebody knows how I can program a stored procedure for automatic backup to
disk in SQL Server 2005 checking the transaction log?
Thanks in advance
Ale
In SQL Server Management Studio, Go to Management, Maintenance Plans, right
click the node and select New. Choose the "Back Up Database Task" option from
the toolbox. Configure the backup wizard as needed.
AndyP,
Sr. Database Administrator,
MCDBA 2003
"Ale" wrote:

> Hi:
> Somebody knows how I can program a stored procedure for automatic backup to
> disk in SQL Server 2005 checking the transaction log?
> Thanks in advance
> Ale
|||ok, I checked this but I have one doubt: how can I check my log? if I want
that my backup init when my log is at 80 %, how can I send an automatic form
the backup process to work? it exists a manner for programming this in SQL
Server 2005? (like a cron in UNIX)
Thanks again
Ale
"AndyP" wrote:
[vbcol=seagreen]
> In SQL Server Management Studio, Go to Management, Maintenance Plans, right
> click the node and select New. Choose the "Back Up Database Task" option from
> the toolbox. Configure the backup wizard as needed.
>
> --
> AndyP,
> Sr. Database Administrator,
> MCDBA 2003
>
> "Ale" wrote:
|||You can create an Agent Performance Condition Alert that triggers on log full percent and trigger
your job that does a backup of the log. If prefer to just schedule my backups regularly, though.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Ale" <Ale@.discussions.microsoft.com> wrote in message
news:02D8FBBD-0BB8-4514-B2D9-051E39DA18B0@.microsoft.com...[vbcol=seagreen]
> ok, I checked this but I have one doubt: how can I check my log? if I want
> that my backup init when my log is at 80 %, how can I send an automatic form
> the backup process to work? it exists a manner for programming this in SQL
> Server 2005? (like a cron in UNIX)
> Thanks again
> Ale
> "AndyP" wrote:
|||Ok, I'll try it!
This Agent triggers when the condition is completed?
Thanks!
Ale
"Tibor Karaszi" wrote:

> You can create an Agent Performance Condition Alert that triggers on log full percent and trigger
> your job that does a backup of the log. If prefer to just schedule my backups regularly, though.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Ale" <Ale@.discussions.microsoft.com> wrote in message
> news:02D8FBBD-0BB8-4514-B2D9-051E39DA18B0@.microsoft.com...
>
>
|||> This Agent triggers when the condition is completed?
When the condition is true, yes. For instance, you can for the counter "Percent log full" specify a
value "raises above" and 80. When that perf mon counter is > 80, the alert is fired.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Ale" <Ale@.discussions.microsoft.com> wrote in message
news:E8BD8E4E-C95C-4A01-903F-C91848F8BD52@.microsoft.com...[vbcol=seagreen]
> Ok, I'll try it!
> This Agent triggers when the condition is completed?
> Thanks!
> Ale
> "Tibor Karaszi" wrote:
|||It′s working!
Thanks!!!
Ale
"Tibor Karaszi" wrote:

> When the condition is true, yes. For instance, you can for the counter "Percent log full" specify a
> value "raises above" and 80. When that perf mon counter is > 80, the alert is fired.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Ale" <Ale@.discussions.microsoft.com> wrote in message
> news:E8BD8E4E-C95C-4A01-903F-C91848F8BD52@.microsoft.com...
> .
>

Automatic Backups

Hi:
Somebody knows how I can program a stored procedure for automatic backup to
disk in SQL Server 2005 checking the transaction log?
Thanks in advance
Ale :)In SQL Server Management Studio, Go to Management, Maintenance Plans, right
click the node and select New. Choose the "Back Up Database Task" option from
the toolbox. Configure the backup wizard as needed.
AndyP,
Sr. Database Administrator,
MCDBA 2003
"Ale" wrote:
> Hi:
> Somebody knows how I can program a stored procedure for automatic backup to
> disk in SQL Server 2005 checking the transaction log?
> Thanks in advance
> Ale :)|||ok, I checked this but I have one doubt: how can I check my log? if I want
that my backup init when my log is at 80 %, how can I send an automatic form
the backup process to work? it exists a manner for programming this in SQL
Server 2005? (like a cron in UNIX)
Thanks again
Ale
"AndyP" wrote:
> In SQL Server Management Studio, Go to Management, Maintenance Plans, right
> click the node and select New. Choose the "Back Up Database Task" option from
> the toolbox. Configure the backup wizard as needed.
>
> --
> AndyP,
> Sr. Database Administrator,
> MCDBA 2003
>
> "Ale" wrote:
> > Hi:
> > Somebody knows how I can program a stored procedure for automatic backup to
> > disk in SQL Server 2005 checking the transaction log?
> > Thanks in advance
> > Ale :)|||You can create an Agent Performance Condition Alert that triggers on log full percent and trigger
your job that does a backup of the log. If prefer to just schedule my backups regularly, though.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Ale" <Ale@.discussions.microsoft.com> wrote in message
news:02D8FBBD-0BB8-4514-B2D9-051E39DA18B0@.microsoft.com...
> ok, I checked this but I have one doubt: how can I check my log? if I want
> that my backup init when my log is at 80 %, how can I send an automatic form
> the backup process to work? it exists a manner for programming this in SQL
> Server 2005? (like a cron in UNIX)
> Thanks again
> Ale
> "AndyP" wrote:
>> In SQL Server Management Studio, Go to Management, Maintenance Plans, right
>> click the node and select New. Choose the "Back Up Database Task" option from
>> the toolbox. Configure the backup wizard as needed.
>>
>> --
>> AndyP,
>> Sr. Database Administrator,
>> MCDBA 2003
>>
>> "Ale" wrote:
>> > Hi:
>> > Somebody knows how I can program a stored procedure for automatic backup to
>> > disk in SQL Server 2005 checking the transaction log?
>> > Thanks in advance
>> > Ale :)|||Ok, I'll try it!
This Agent triggers when the condition is completed?
Thanks!
Ale :)
"Tibor Karaszi" wrote:
> You can create an Agent Performance Condition Alert that triggers on log full percent and trigger
> your job that does a backup of the log. If prefer to just schedule my backups regularly, though.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Ale" <Ale@.discussions.microsoft.com> wrote in message
> news:02D8FBBD-0BB8-4514-B2D9-051E39DA18B0@.microsoft.com...
> > ok, I checked this but I have one doubt: how can I check my log? if I want
> > that my backup init when my log is at 80 %, how can I send an automatic form
> > the backup process to work? it exists a manner for programming this in SQL
> > Server 2005? (like a cron in UNIX)
> > Thanks again
> > Ale
> >
> > "AndyP" wrote:
> >
> >> In SQL Server Management Studio, Go to Management, Maintenance Plans, right
> >> click the node and select New. Choose the "Back Up Database Task" option from
> >> the toolbox. Configure the backup wizard as needed.
> >>
> >>
> >> --
> >> AndyP,
> >> Sr. Database Administrator,
> >> MCDBA 2003
> >>
> >>
> >> "Ale" wrote:
> >>
> >> > Hi:
> >> > Somebody knows how I can program a stored procedure for automatic backup to
> >> > disk in SQL Server 2005 checking the transaction log?
> >> > Thanks in advance
> >> > Ale :)
>
>|||> This Agent triggers when the condition is completed?
When the condition is true, yes. For instance, you can for the counter "Percent log full" specify a
value "raises above" and 80. When that perf mon counter is > 80, the alert is fired.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Ale" <Ale@.discussions.microsoft.com> wrote in message
news:E8BD8E4E-C95C-4A01-903F-C91848F8BD52@.microsoft.com...
> Ok, I'll try it!
> This Agent triggers when the condition is completed?
> Thanks!
> Ale :)
> "Tibor Karaszi" wrote:
>> You can create an Agent Performance Condition Alert that triggers on log full percent and trigger
>> your job that does a backup of the log. If prefer to just schedule my backups regularly, though.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "Ale" <Ale@.discussions.microsoft.com> wrote in message
>> news:02D8FBBD-0BB8-4514-B2D9-051E39DA18B0@.microsoft.com...
>> > ok, I checked this but I have one doubt: how can I check my log? if I want
>> > that my backup init when my log is at 80 %, how can I send an automatic form
>> > the backup process to work? it exists a manner for programming this in SQL
>> > Server 2005? (like a cron in UNIX)
>> > Thanks again
>> > Ale
>> >
>> > "AndyP" wrote:
>> >
>> >> In SQL Server Management Studio, Go to Management, Maintenance Plans, right
>> >> click the node and select New. Choose the "Back Up Database Task" option from
>> >> the toolbox. Configure the backup wizard as needed.
>> >>
>> >>
>> >> --
>> >> AndyP,
>> >> Sr. Database Administrator,
>> >> MCDBA 2003
>> >>
>> >>
>> >> "Ale" wrote:
>> >>
>> >> > Hi:
>> >> > Somebody knows how I can program a stored procedure for automatic backup to
>> >> > disk in SQL Server 2005 checking the transaction log?
>> >> > Thanks in advance
>> >> > Ale :)
>>|||It´s working!
Thanks!!!
Ale
"Tibor Karaszi" wrote:
> > This Agent triggers when the condition is completed?
> When the condition is true, yes. For instance, you can for the counter "Percent log full" specify a
> value "raises above" and 80. When that perf mon counter is > 80, the alert is fired.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Ale" <Ale@.discussions.microsoft.com> wrote in message
> news:E8BD8E4E-C95C-4A01-903F-C91848F8BD52@.microsoft.com...
> > Ok, I'll try it!
> > This Agent triggers when the condition is completed?
> > Thanks!
> > Ale :)
> >
> > "Tibor Karaszi" wrote:
> >
> >> You can create an Agent Performance Condition Alert that triggers on log full percent and trigger
> >> your job that does a backup of the log. If prefer to just schedule my backups regularly, though.
> >>
> >> --
> >> Tibor Karaszi, SQL Server MVP
> >> http://www.karaszi.com/sqlserver/default.asp
> >> http://www.solidqualitylearning.com/
> >>
> >>
> >> "Ale" <Ale@.discussions.microsoft.com> wrote in message
> >> news:02D8FBBD-0BB8-4514-B2D9-051E39DA18B0@.microsoft.com...
> >> > ok, I checked this but I have one doubt: how can I check my log? if I want
> >> > that my backup init when my log is at 80 %, how can I send an automatic form
> >> > the backup process to work? it exists a manner for programming this in SQL
> >> > Server 2005? (like a cron in UNIX)
> >> > Thanks again
> >> > Ale
> >> >
> >> > "AndyP" wrote:
> >> >
> >> >> In SQL Server Management Studio, Go to Management, Maintenance Plans, right
> >> >> click the node and select New. Choose the "Back Up Database Task" option from
> >> >> the toolbox. Configure the backup wizard as needed.
> >> >>
> >> >>
> >> >> --
> >> >> AndyP,
> >> >> Sr. Database Administrator,
> >> >> MCDBA 2003
> >> >>
> >> >>
> >> >> "Ale" wrote:
> >> >>
> >> >> > Hi:
> >> >> > Somebody knows how I can program a stored procedure for automatic backup to
> >> >> > disk in SQL Server 2005 checking the transaction log?
> >> >> > Thanks in advance
> >> >> > Ale :)
> >>
> >>
> >>
> .
>

Thursday, March 8, 2012

Automated db mirroring

I have two database servers. My primary server contains the live database.
I'd like to set up an automated script program to take nightly snapshots of
the live database onto my secondary DB server.
How do I go about doing this?
What you are looking for is called Log Shipping. It is a built-in feature
of Enterprise Edition and can be 'bolted on' to other editions. There is a
simple example in the SQL Server Resource Kit you can adapt for your needs.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
"Ed" <eddiemarino@.hotmail.com> wrote in message
news:OOT502ILEHA.3012@.tk2msftngp13.phx.gbl...
> I have two database servers. My primary server contains the live
database.
> I'd like to set up an automated script program to take nightly snapshots
of
> the live database onto my secondary DB server.
> How do I go about doing this?
>

Automated db mirroring

I have two database servers. My primary server contains the live database.
I'd like to set up an automated script program to take nightly snapshots of
the live database onto my secondary DB server.
How do I go about doing this?What you are looking for is called Log Shipping. It is a built-in feature
of Enterprise Edition and can be 'bolted on' to other editions. There is a
simple example in the SQL Server Resource Kit you can adapt for your needs.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
"Ed" <eddiemarino@.hotmail.com> wrote in message
news:OOT502ILEHA.3012@.tk2msftngp13.phx.gbl...
> I have two database servers. My primary server contains the live
database.
> I'd like to set up an automated script program to take nightly snapshots
of
> the live database onto my secondary DB server.
> How do I go about doing this?
>

Automated db mirroring

I have two database servers. My primary server contains the live database.
I'd like to set up an automated script program to take nightly snapshots of
the live database onto my secondary DB server.
How do I go about doing this?What you are looking for is called Log Shipping. It is a built-in feature
of Enterprise Edition and can be 'bolted on' to other editions. There is a
simple example in the SQL Server Resource Kit you can adapt for your needs.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
"Ed" <eddiemarino@.hotmail.com> wrote in message
news:OOT502ILEHA.3012@.tk2msftngp13.phx.gbl...
> I have two database servers. My primary server contains the live
database.
> I'd like to set up an automated script program to take nightly snapshots
of
> the live database onto my secondary DB server.
> How do I go about doing this?
>

Wednesday, March 7, 2012

automate passing

hi!

i already have a program that when you click a button it will get the new transactions in the database then pass it to another database now i need to automate the passing... once there is a new entry in the database it should automatically pass it to the other database. how could i do this?!

thanks!

I believe there is a way to do such mirroring if the databases are both SQL Server databases and if that is the case you should post the same question to the appropriate SQL form...

Otherwise one could write a service application, an application with no GUI which runs as a windows service i.e not as a user, but the system, to check for the transfer condition, then do the read from the first database then write out to the second database. Here are a couple of links to get you started.
Windows Service Application|||

my other database is Oracle. But thanks for the links you gave! it was very helpful! ^_^

i now know how to create the windows service but how can i modify my previous program... originally the button has to be clicked for the transaction to be passed.. it also has an interface (a form with 2 buttons). Any tips or suggestions as to how i would change it?

thanks again!

|||You need to isolate the business logic away from the GUI logic. Its a common problem for people writing quick code...it all gets placed into one layer.

What you need to do is create a new assembly (library assembly) which will hold just the logic of contacting the database and returning or processing into it the data. Once that code is in a separate assembly, have the GUI application reference that assembly then remove the current db access code. Then wire in the GUI to use the new database/biz logic code from the newly created assembly.

Once you have it broken out you can now work on creating a windows service which will do the work in the background so to speak.

As a developer, get into the habit of always separating the code into layers. You may have heard of a three tiered architecture and this is what you are striving for... The first layer is a GUI or service or unit test layer which contacts a business layer which in turn contacts the database layer. Each of those layers are in separate assemblies which lend themselves to being unit tested outside the application via either NUnit tests or console applications linking in... Good luck.|||thanks for the explanation! ^__^

Saturday, February 25, 2012

Autoimport from xls to SQL 2000?

I have a program setup the exports check request data into a xls file every
week on a shared directory on Windows 2003 server. I'd like a way to import
that data into SQL 2000 on a weekly basis. (Shared directory and SQL on same
server).
Ideas?
just create a dts job to do it.
"Cwhitmore" <Cwhitmore@.discussions.microsoft.com> wrote in message
news:42DDB5A3-0F75-4ABE-B7D5-CBA86251AC6C@.microsoft.com...
>I have a program setup the exports check request data into a xls file every
> week on a shared directory on Windows 2003 server. I'd like a way to
> import
> that data into SQL 2000 on a weekly basis. (Shared directory and SQL on
> same
> server).
> Ideas?
>