Showing posts with label osql. Show all posts
Showing posts with label osql. Show all posts

Friday, February 17, 2012

Create DB using OSQL is SLOW

The creation of a database, tables, stored procs, etc is EXTREMELY slow. This same script with Sql Server 2000 took about 8-10 minutes is now taking 45-50 minutes with Sql Server 2005.

This is an example: osql -E -S (local) -n -d <DB> -i <StoredProc>.sql

using SQL Server 9.0.1399

Any thoughts are appreciated.

with sql server 2005 you should use sqlcmd instead. You should find that is faster.

Tuesday, February 14, 2012

Create Database by using OSQL

I have to create database usign OSQL. i am usin a command like this

C:> osql -E -i db1.sql

But it doesnt create database and returns error saying user login
failed for administrator whereas I have no user for SQL server n it
uses by default . I also tried with sa username by entering it with -U
switch in command but still it gaves same error. Can anyone help meHi

You will need to post db1.sql to be certain. Try using the command without
specifying the file and see what it says. If you are not connecting to the
default instance/database then specify the server -S flag (it may be better
to do this regardless!) and database -d flag as well. If you are not an
administrator (or the BUILDIN\Administrators group has been removed from the
logins) then specifying -U sa -P<sa password>.

John

<arfanameer@.hotmail.com> wrote in message
news:1103900360.199670.188710@.z14g2000cwz.googlegr oups.com...
>I have to create database usign OSQL. i am usin a command like this
> C:> osql -E -i db1.sql
> But it doesnt create database and returns error saying user login
> failed for administrator whereas I have no user for SQL server n it
> uses by default . I also tried with sa username by entering it with -U
> switch in command but still it gaves same error. Can anyone help me|||arfanameer@.hotmail.com (arfanameer@.hotmail.com) writes:
> I have to create database usign OSQL. i am usin a command like this
> C:> osql -E -i db1.sql
> But it doesnt create database and returns error saying user login
> failed for administrator whereas I have no user for SQL server n it
> uses by default . I also tried with sa username by entering it with -U
> switch in command but still it gaves same error. Can anyone help me

If you get exactly the same error message if you specify "-U sa", then
the server is not configured for SQL authentication.

It would help if you posted the exact error message.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

create database at shared hoster site

I have an sql script that I ran on my local system using osql. It
created all the tables, views, and even inserted sample data into the
tables.

Now I need to create that same database on a shared hoster site. Only
the hoster does not allow the running of osql.

How can I create my sql server database on my shared hoster site?

Can I save and restore my database somehow?

Is there a stored procedure I can run which will run the .sql script
file?

thanks,

-SteveThat depends on how your provider expects you to execute SQL code - if
they don't allow osql.exe, then what do they allow? And how do you
connect to the hosted database - do you use Enterprise Manager? Since
osql.exe is just a client application, if you can connect to the SQL
server then you should be able to use it.

Simon|||Simon Hayes wrote:
> That depends on how your provider expects you to execute SQL code -
if
> they don't allow osql.exe, then what do they allow?

the hoster is godaddy.com You do get a panel where you can manually
config the database. There is something called "Query Analyser" which
provides a window to run sql statements. I dont think this is the same
as the Microsoft Query Analyzer that I read about yesterday. In this
godaddy qa window I cannot "run sqlscript.sql" like I think you can do
in Microsoft Query Analyzer.

What I was able to do was cut and paste large sections of my script.sql
from my PC editor into the GoDaddy "Query Analyser" window. Then I
clicked the "submit" button and it basically worked.

> And how do you
> connect to the hosted database - do you use Enterprise Manager?

> Since
> osql.exe is just a client application, if you can connect to the SQL
> server then you should be able to use it.

well my asp.net code can use the SqlConnection class to connect to the
database, then use SqlCommand to run SQL commands. Can osql be run in
that context?

I am curious to know if there is a stored procedure I can use which
will run an .sql script.

thanks,

-Steve|||You might be able to re-use this code in ASP:

http://groups-beta.google.com/group...e72b5441b?hl=en

A web interface which doesn't allow uploading scripts is quite limited
- I would definitely ask the provider if they can enhance it.

There's no stored proc to run a file, probably because the server would
need to have access to the script file somehow, which is tricky if it's
on your workstation. It's common to use xp_cmdshell to call osql.exe as
a way of executing scripts, but that's only really useful for syadmins,
because of the security implications.

Simon|||Simon Hayes wrote:
> You might be able to re-use this code in ASP:
>
http://groups-beta.google.com/group...e72b5441b?hl=en

that looks to be exactly what I am looking for.

thanks very much,

-Steve

> A web interface which doesn't allow uploading scripts is quite
limited
> - I would definitely ask the provider if they can enhance it.
> There's no stored proc to run a file, probably because the server
would
> need to have access to the script file somehow, which is tricky if
it's
> on your workstation. It's common to use xp_cmdshell to call osql.exe
as
> a way of executing scripts, but that's only really useful for
syadmins,
> because of the security implications.
> Simon

Create DataBase and trigers, logins etc... in instalation...HELP

Hi,
My aplication use MSDE and,
I need create database, trigers etc... in instalation of MSDE.
What I had use: osql, callback, api...
How I do this...
Any idea?
Thanks.
Hi,
MSDE will not provide the normal GUI utilities. So you have to do all TSQL
statements using the utility OSQL from comamnd prompt.
OSQL -Usa -Ppassword -Sserver (enter)
1>create database <dbname>
2>go
1> create trigger abc_tri on cust for insert as select custno from cust
2>go
The list goes on.. For command syntax you can refer SQL server books online.
Note:
Now microsoft is providing web based free tool to administer the database.
Using this you can do coding as well
as administration stuff like creating database, increasing size, creating
tables, triggers , proceduers ...ect...
Download webadmin tool from below site.
http://www.microsoft.com/downloads/d...798-C57A-419E-
ACBC-2A332CB7F959&displaylang=en
Thanks
Hari
MCDBA
"Vanda Forti" <tforti@.terra.com.br> wrote in message
news:OrhhPApZEHA.212@.TK2MSFTNGP12.phx.gbl...
> Hi,
> My aplication use MSDE and,
> I need create database, trigers etc... in instalation of MSDE.
> What I had use: osql, callback, api...
> How I do this...
> Any idea?
> Thanks.
>
|||Hi
you can also have a look to this web based GUI : myLittleAdmin
http://www.myLittleTools.net/mla_sql
Hope this helps !
Elian Chrebor
// myLittleTools.net : leading provider of web-based applications.
// myLittleAdmin : online MS SQL manager
// http://www.mylittletools.net
// webmaster@.mylittletools.net
Hari Prasad typed:
> Hi,
> MSDE will not provide the normal GUI utilities. So you have to do all
> TSQL statements using the utility OSQL from comamnd prompt.
> OSQL -Usa -Ppassword -Sserver (enter)
> 1>create database <dbname>
> 2>go
> 1> create trigger abc_tri on cust for insert as select custno from
> cust 2>go
>
> The list goes on.. For command syntax you can refer SQL server books
> online.
>
> Note:
> Now microsoft is providing web based free tool to administer the
> database. Using this you can do coding as well
> as administration stuff like creating database, increasing size,
> creating tables, triggers , proceduers ...ect...
> Download webadmin tool from below site.
>
>
http://www.microsoft.com/downloads/d...039A798-C57A-4
19E-[vbcol=seagreen]
> ACBC-2A332CB7F959&displaylang=en
> Thanks
> Hari
> MCDBA
>
>
> "Vanda Forti" <tforti@.terra.com.br> wrote in message
> news:OrhhPApZEHA.212@.TK2MSFTNGP12.phx.gbl...