Showing posts with label config. Show all posts
Showing posts with label config. Show all posts

Wednesday, March 21, 2012

DB Script

hello I need to script my Db, tables and storedprocedures. so i can create another same DB

Dim con As New SqlConnection(DBClass.Config.DBString)
Dim cmdName As String = File.OpenText("pro.sql").ReadToEnd()
Dim cmd As New SqlCommand(cmdName, con)
cmd.CommandType = CommandType.Text
con.Open()
Try
cmd.ExecuteNonQuery()
MessageBox.Show("DB Created")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

con.Close()

Any suggestions plzzzzzzzzzzz

you can right click on your DB and generate scripts for all objects in your DB. If you want to do it programmatically run the profiler and see what mgmt studio is doing to generate the scripts. You can do the same from your application.|||If SMO is used (liek in SSMS) There is some more information needed than this which is queried fromt he SQl Server. I would suggest using the SMO namespace for creating your script. SMO is the successor of DMO and has a dependency walker to keep track of dependent objects.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de|||

if ur using sqlserver 2000 make use of the sql DMO functions...simple functions to achive wat u want... examples at C:\Program Files\Microsoft SQL Server\80\Tools\Devtools\Samples\Sqldmo

similarly for SS 2005 though DMO are supported(just for backward compatibility,wont be there in future editions), u can use SMO,which offers many additional functions...

|||Can you give me some more details about that plz|||have you looked in the folder in the post?

There should be a demo for you to look at which should give you more info as you requested.|||

I have no problem creating Data Base, I just want to have SQLScript(tables and procedures), this file called db.sql
Then I want to use this code, why Im having problem creating the procedures?

Dim con As New SqlConnection(DBClass.Config.DBString)
Dim cmdName As String = File.OpenText("db.sql").ReadToEnd()
Dim cmd As New SqlCommand(cmdName, con)
cmd.CommandType = CommandType.Text
con.Open()
Try
cmd.ExecuteNonQuery()
MessageBox.Show("DB Created")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

con.Close()

|||hmmm,

we seem to be duplicating ourselves as you have an open topic here; http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1006948&SiteID=1

In this thread I provide you with a code example, the example lets you read a script in a StreamReader, then execute this script on a database.

Please be careful you dont upset people posting the same questions in multiple topics

Sunday, February 19, 2012

DB Mail config

I am trying to setup db mail and I cannot get it to send an email. I have
enabled e-mail using the surface area configurator. I went through the db
mail setup wizard and entered all the appropiate info, but when I try to
send a test email, I get the following error in the db mail log:
The mail could not be sent to the recipients because of the mail server
failure. (Sending Mail using Account 3 (2006-09-14T09:27:22). Exception
Message: Cannot send mails to mail server. (Failure sending mail.).
).
What could be causing this?
Thanks,
What type of server are you using for Mail. Some SMTP server? Does the db
mail account have access to relay on the SMTP server. Can you ping the SMTP
server from the SQL server?
What does the event log say as far as DB mail errors?
/*
Warren Brunk - MCITP - SQL 2005, MCDBA
www.techintsolutions.com
*/
"Tim Kelley" <tkelley@.company.com> wrote in message
news:uMroorA2GHA.4392@.TK2MSFTNGP04.phx.gbl...
>I am trying to setup db mail and I cannot get it to send an email. I have
>enabled e-mail using the surface area configurator. I went through the db
>mail setup wizard and entered all the appropiate info, but when I try to
>send a test email, I get the following error in the db mail log:
> The mail could not be sent to the recipients because of the mail server
> failure. (Sending Mail using Account 3 (2006-09-14T09:27:22). Exception
> Message: Cannot send mails to mail server. (Failure sending mail.).
> ).
> What could be causing this?
> Thanks,
>
|||We are using SMTP for the mail server. I am using my own account to send
the mail so it should have access to relay on the mail server. I can ping
the SMTP server from the SQL server. I didn't find any errors in the SQL
log or the system application log.
Tim
"Warren Brunk" <wbrunk@.techintsolutions.com> wrote in message
news:%23up92$C2GHA.4264@.TK2MSFTNGP05.phx.gbl...
> What type of server are you using for Mail. Some SMTP server? Does the db
> mail account have access to relay on the SMTP server. Can you ping the
> SMTP server from the SQL server?
> What does the event log say as far as DB mail errors?
> --
> /*
> Warren Brunk - MCITP - SQL 2005, MCDBA
> www.techintsolutions.com
> */
>
> "Tim Kelley" <tkelley@.company.com> wrote in message
> news:uMroorA2GHA.4392@.TK2MSFTNGP04.phx.gbl...
>

DB Mail config

I am trying to setup db mail and I cannot get it to send an email. I have
enabled e-mail using the surface area configurator. I went through the db
mail setup wizard and entered all the appropiate info, but when I try to
send a test email, I get the following error in the db mail log:
The mail could not be sent to the recipients because of the mail server
failure. (Sending Mail using Account 3 (2006-09-14T09:27:22). Exception
Message: Cannot send mails to mail server. (Failure sending mail.).
).
What could be causing this?
Thanks,What type of server are you using for Mail. Some SMTP server? Does the db
mail account have access to relay on the SMTP server. Can you ping the SMTP
server from the SQL server?
What does the event log say as far as DB mail errors?
/*
Warren Brunk - MCITP - SQL 2005, MCDBA
www.techintsolutions.com
*/
"Tim Kelley" <tkelley@.company.com> wrote in message
news:uMroorA2GHA.4392@.TK2MSFTNGP04.phx.gbl...
>I am trying to setup db mail and I cannot get it to send an email. I have
>enabled e-mail using the surface area configurator. I went through the db
>mail setup wizard and entered all the appropiate info, but when I try to
>send a test email, I get the following error in the db mail log:
> The mail could not be sent to the recipients because of the mail server
> failure. (Sending Mail using Account 3 (2006-09-14T09:27:22). Exception
> Message: Cannot send mails to mail server. (Failure sending mail.).
> ).
> What could be causing this?
> Thanks,
>|||We are using SMTP for the mail server. I am using my own account to send
the mail so it should have access to relay on the mail server. I can ping
the SMTP server from the SQL server. I didn't find any errors in the SQL
log or the system application log.
Tim
"Warren Brunk" <wbrunk@.techintsolutions.com> wrote in message
news:%23up92$C2GHA.4264@.TK2MSFTNGP05.phx.gbl...
> What type of server are you using for Mail. Some SMTP server? Does the db
> mail account have access to relay on the SMTP server. Can you ping the
> SMTP server from the SQL server?
> What does the event log say as far as DB mail errors?
> --
> /*
> Warren Brunk - MCITP - SQL 2005, MCDBA
> www.techintsolutions.com
> */
>
> "Tim Kelley" <tkelley@.company.com> wrote in message
> news:uMroorA2GHA.4392@.TK2MSFTNGP04.phx.gbl...
>

DB Mail config

I am trying to setup db mail and I cannot get it to send an email. I have
enabled e-mail using the surface area configurator. I went through the db
mail setup wizard and entered all the appropiate info, but when I try to
send a test email, I get the following error in the db mail log:
The mail could not be sent to the recipients because of the mail server
failure. (Sending Mail using Account 3 (2006-09-14T09:27:22). Exception
Message: Cannot send mails to mail server. (Failure sending mail.).
).
What could be causing this?
Thanks,What type of server are you using for Mail. Some SMTP server? Does the db
mail account have access to relay on the SMTP server. Can you ping the SMTP
server from the SQL server?
What does the event log say as far as DB mail errors?
--
/*
Warren Brunk - MCITP - SQL 2005, MCDBA
www.techintsolutions.com
*/
"Tim Kelley" <tkelley@.company.com> wrote in message
news:uMroorA2GHA.4392@.TK2MSFTNGP04.phx.gbl...
>I am trying to setup db mail and I cannot get it to send an email. I have
>enabled e-mail using the surface area configurator. I went through the db
>mail setup wizard and entered all the appropiate info, but when I try to
>send a test email, I get the following error in the db mail log:
> The mail could not be sent to the recipients because of the mail server
> failure. (Sending Mail using Account 3 (2006-09-14T09:27:22). Exception
> Message: Cannot send mails to mail server. (Failure sending mail.).
> ).
> What could be causing this?
> Thanks,
>|||We are using SMTP for the mail server. I am using my own account to send
the mail so it should have access to relay on the mail server. I can ping
the SMTP server from the SQL server. I didn't find any errors in the SQL
log or the system application log.
Tim
"Warren Brunk" <wbrunk@.techintsolutions.com> wrote in message
news:%23up92$C2GHA.4264@.TK2MSFTNGP05.phx.gbl...
> What type of server are you using for Mail. Some SMTP server? Does the db
> mail account have access to relay on the SMTP server. Can you ping the
> SMTP server from the SQL server?
> What does the event log say as far as DB mail errors?
> --
> /*
> Warren Brunk - MCITP - SQL 2005, MCDBA
> www.techintsolutions.com
> */
>
> "Tim Kelley" <tkelley@.company.com> wrote in message
> news:uMroorA2GHA.4392@.TK2MSFTNGP04.phx.gbl...
>>I am trying to setup db mail and I cannot get it to send an email. I have
>>enabled e-mail using the surface area configurator. I went through the db
>>mail setup wizard and entered all the appropiate info, but when I try to
>>send a test email, I get the following error in the db mail log:
>> The mail could not be sent to the recipients because of the mail server
>> failure. (Sending Mail using Account 3 (2006-09-14T09:27:22). Exception
>> Message: Cannot send mails to mail server. (Failure sending mail.).
>> ).
>> What could be causing this?
>> Thanks,
>

Tuesday, February 14, 2012

DB Disk Hot Split question

Hello:
I am using SAN storage to store the DB files. The SAN disk is in
mirror. Does any config that I can perform the hot split the SAN mirror
disk and the DB files can be use as backup purpose?
It was because I have try to split the disk but those DB files can't be
mount on the same DB server.
Thanks!
Most SAN vendors support this type of mirror split. EMC calls it BCV split.
To use the split mirror for backup, it has to be integrated with SQL Server
VDI so that I/Os can be quiesced briefly to get a rcoveable image.
You need to follow the SAN vendor's instructions to do this right.
Linchi
"Blue Fish" wrote:

> Hello:
> I am using SAN storage to store the DB files. The SAN disk is in
> mirror. Does any config that I can perform the hot split the SAN mirror
> disk and the DB files can be use as backup purpose?
> It was because I have try to split the disk but those DB files can't be
> mount on the same DB server.
> Thanks!
>
|||Thanks a lot for your information. If I am using HDS, that means I need
to purchase the SplitSecond to do that, right?
Thanks!
Linchi Shea wrote:[vbcol=seagreen]
> Most SAN vendors support this type of mirror split. EMC calls it BCV split.
> To use the split mirror for backup, it has to be integrated with SQL Server
> VDI so that I/Os can be quiesced briefly to get a rcoveable image.
> You need to follow the SAN vendor's instructions to do this right.
> Linchi
> "Blue Fish" wrote:

DB Disk Hot Split question

Hello:
I am using SAN storage to store the DB files. The SAN disk is in
mirror. Does any config that I can perform the hot split the SAN mirror
disk and the DB files can be use as backup purpose?
It was because I have try to split the disk but those DB files can't be
mount on the same DB server.
Thanks!Most SAN vendors support this type of mirror split. EMC calls it BCV split.
To use the split mirror for backup, it has to be integrated with SQL Server
VDI so that I/Os can be quiesced briefly to get a rcoveable image.
You need to follow the SAN vendor's instructions to do this right.
Linchi
"Blue Fish" wrote:
> Hello:
> I am using SAN storage to store the DB files. The SAN disk is in
> mirror. Does any config that I can perform the hot split the SAN mirror
> disk and the DB files can be use as backup purpose?
> It was because I have try to split the disk but those DB files can't be
> mount on the same DB server.
> Thanks!
>|||Thanks a lot for your information. If I am using HDS, that means I need
to purchase the SplitSecond to do that, right?
Thanks!
Linchi Shea wrote:
> Most SAN vendors support this type of mirror split. EMC calls it BCV split.
> To use the split mirror for backup, it has to be integrated with SQL Server
> VDI so that I/Os can be quiesced briefly to get a rcoveable image.
> You need to follow the SAN vendor's instructions to do this right.
> Linchi
> "Blue Fish" wrote:
>> Hello:
>> I am using SAN storage to store the DB files. The SAN disk is in
>> mirror. Does any config that I can perform the hot split the SAN mirror
>> disk and the DB files can be use as backup purpose?
>> It was because I have try to split the disk but those DB files can't be
>> mount on the same DB server.
>> Thanks!

DB Disk Hot Split question

Hello:
I am using SAN storage to store the DB files. The SAN disk is in
mirror. Does any config that I can perform the hot split the SAN mirror
disk and the DB files can be use as backup purpose?
It was because I have try to split the disk but those DB files can't be
mount on the same DB server.
Thanks!Most SAN vendors support this type of mirror split. EMC calls it BCV split.
To use the split mirror for backup, it has to be integrated with SQL Server
VDI so that I/Os can be quiesced briefly to get a rcoveable image.
You need to follow the SAN vendor's instructions to do this right.
Linchi
"Blue Fish" wrote:

> Hello:
> I am using SAN storage to store the DB files. The SAN disk is in
> mirror. Does any config that I can perform the hot split the SAN mirror
> disk and the DB files can be use as backup purpose?
> It was because I have try to split the disk but those DB files can't be
> mount on the same DB server.
> Thanks!
>|||Thanks a lot for your information. If I am using HDS, that means I need
to purchase the SplitSecond to do that, right?
Thanks!
Linchi Shea wrote:[vbcol=seagreen]
> Most SAN vendors support this type of mirror split. EMC calls it BCV split
.
> To use the split mirror for backup, it has to be integrated with SQL Serve
r
> VDI so that I/Os can be quiesced briefly to get a rcoveable image.
> You need to follow the SAN vendor's instructions to do this right.
> Linchi
> "Blue Fish" wrote:
>