create database from a shell script

This is a discussion on create database from a shell script within the sybase forums in Other Databases category; Hello I am looking for a script that creates a database like this: createdb -N -S -s 2000 to create a database of 2G In the script, I will use this: isql -U sa -P -S server_name create database on =2000 how to search for a free device_name that has less than 2G space? Do you have any other script that automatically creates a database? thank you!...

Go Back   Database Forum > Other Databases > sybase

Database Forums

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-19-2008, 09:22 AM
Default create database from a shell script

Hello

I am looking for a script that creates a database like this:

createdb -N -S -s 2000

to create a database of 2G

In the script, I will use this:

isql -U sa -P -S server_name
create database on =2000


how to search for a free device_name that has less than 2G
space?

Do you have any other script that automatically creates a
database?

thank you!
Reply With Quote
  #2  
Old 08-19-2008, 09:55 AM
Default Re: create database from a shell script


wrote in message news:48aabb1a.1952.1681692777-at-sybase.com...
> Hello
>
> I am looking for a script that creates a database like this:
>
> createdb -N -S -s 2000
>
> to create a database of 2G
>
> In the script, I will use this:
>
> isql -U sa -P -S server_name
> create database on =2000
>
>
> how to search for a free device_name that has less than 2G
> space?
>
> Do you have any other script that automatically creates a
> database?
>
> thank you!


(1) 2000MB is not the same as 2GB (2048MB).
(2) You really do not want to seperate data and log?
(3) You want the database to be on only one device?
(4) But it can be in fragments on the device?
(5) Your script example provides no of specifying the two arguments. I
assume that you mean something more general. (I've forgotten if "create
database" is valid within a stored procedure or not. If not, then perhaps
(?) dynamic SQL can be used.)
(6) Which release do you have?
(7) Most importantly, do you really want to "administer" a server in this
fashion? This method has a "hack" feeling to it.


Reply With Quote
  #3  
Old 08-19-2008, 10:08 AM
Default Re: create database from a shell script

Hello and thanks for the reply.

(1) 2000MB is not the same as 2GB (2048MB).
Thanks for the info
(2) You really do not want to seperate data and log?
No (for the moment)
(3) You want the database to be on only one device?
Yes (for the moment)
(4) But it can be in fragments on the device?
Yes
(5) Your script example provides no of specifying the two
arguments. I
assume that you mean something more general. (I've
forgotten if "create
database" is valid within a stored procedure or not. If
not, then perhaps
(?) dynamic SQL can be used.)
A stored procedure is also an option
(6) Which release do you have?
12.5.4
(7) Most importantly, do you really want to "administer" a
server in this fashion? This method has a "hack" feeling to
it.

Yes.

thanks again

> wrote in message
> > news:48aabb1a.1952.1681692777-at-sybase.com... Hello
> >
> > I am looking for a script that creates a database like

> this: >
> > createdb -N -S -s 2000
> >
> > to create a database of 2G
> >
> > In the script, I will use this:
> >
> > isql -U sa -P -S server_name
> > create database on =2000
> >
> >
> > how to search for a free device_name that has less than
> > 2G space?
> >
> > Do you have any other script that automatically creates
> > a database?
> >
> > thank you!

>
> (1) 2000MB is not the same as 2GB (2048MB).
> (2) You really do not want to seperate data and log?
> (3) You want the database to be on only one device?
> (4) But it can be in fragments on the device?
> (5) Your script example provides no of specifying the two
> arguments. I assume that you mean something more
> general. (I've forgotten if "create database" is valid
> within a stored procedure or not. If not, then perhaps
> (?) dynamic SQL can be used.) (6) Which release do you
> have? (7) Most importantly, do you really want to
> "administer" a server in this fashion? This method has a
> "hack" feeling to it.
>
>

Reply With Quote
  #4  
Old 08-19-2008, 04:08 PM
Default Re: create database from a shell script

Realizing that you can end up with some odd fragments in
sysusages, and you could have some performance issues, and
you'll have data and log mixed on the same devices ...

- create your devices (disk init)
- flag each device as a 'default' device (sp_diskdefault)
- create your databases on the 'default' device (create
database on default = )

The above should allow you to create databases on any
'default' disks that still have some space available, ie,
there's no need for you to know the name of devices with
free space.

NOTE: I'd recommend disabling the master device as a
default disk.

> Hello and thanks for the reply.
>
> (1) 2000MB is not the same as 2GB (2048MB).
> Thanks for the info
> (2) You really do not want to seperate data and log?
> No (for the moment)
> (3) You want the database to be on only one device?
> Yes (for the moment)
> (4) But it can be in fragments on the device?
> Yes
> (5) Your script example provides no of specifying the two
> arguments. I
> assume that you mean something more general. (I've
> forgotten if "create
> database" is valid within a stored procedure or not. If
> not, then perhaps
> (?) dynamic SQL can be used.)
> A stored procedure is also an option
> (6) Which release do you have?
> 12.5.4
> (7) Most importantly, do you really want to "administer"
> a server in this fashion? This method has a "hack"
> feeling to it.
>
> Yes.
>
> thanks again
>
> > wrote in message
> > > news:48aabb1a.1952.1681692777-at-sybase.com... Hello
> > >
> > > I am looking for a script that creates a database like

> > this: >
> > > createdb -N -S -s 2000
> > >
> > > to create a database of 2G
> > >
> > > In the script, I will use this:
> > >
> > > isql -U sa -P -S server_name
> > > create database on =2000
> > >
> > >
> > > how to search for a free device_name that has less
> > > than 2G space?
> > >
> > > Do you have any other script that automatically
> > > creates a database?
> > >
> > > thank you!

> >
> > (1) 2000MB is not the same as 2GB (2048MB).
> > (2) You really do not want to seperate data and log?
> > (3) You want the database to be on only one device?
> > (4) But it can be in fragments on the device?
> > (5) Your script example provides no of specifying the
> > two arguments. I assume that you mean something more
> > general. (I've forgotten if "create database" is valid
> > within a stored procedure or not. If not, then perhaps
> > (?) dynamic SQL can be used.) (6) Which release do you
> > have? (7) Most importantly, do you really want to
> > "administer" a server in this fashion? This method has
> > a "hack" feeling to it.
> >
> >

Reply With Quote
  #5  
Old 08-24-2008, 04:19 AM
Default Re: create database from a shell script

Mark A. Parsons wrote:
> Realizing that you can end up with some odd fragments in
> sysusages, and you could have some performance issues, and
> you'll have data and log mixed on the same devices ...
>
> - create your devices (disk init)
> - flag each device as a 'default' device (sp_diskdefault)
> - create your databases on the 'default' device (create
> database on default = )
>
> The above should allow you to create databases on any
> 'default' disks that still have some space available, ie,
> there's no need for you to know the name of devices with
> free space.
>
> NOTE: I'd recommend disabling the master device as a
> default disk.


If I was stuck doing administration through a series of shell scripts, I
would make it a bit more elaborate using the 'dos-like' screens provided
by the dialog tool. That way, I wouldn't have to remember which script
did what and what the options were at 3am in the morning.

example) Have a screen show available space and have a dialog screen
option to either place the new database on available space auto
magically or specify the placement manually.

This kind of console based GUI interface isn't necessarily a bad thing
to use - Database Artisan does the same but as a windows gui not a console
gui. Use what works


--
Jason L. Froebe
TeamSybase
http://www.froebe.net/blog
MyDatabases Free Magazine http://froebe.net/blog/mydatabases-magazine/
Reply With Quote
Reply


Thread Tools
Display Modes



All times are GMT -4. The time now is 07:10 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by bbpixel2008 :: jvbPlugin R1013.368.1

Search Engine Friendly URLs by vBSEO 3.1.0
vB Ad Management by =RedTyger=
In an effort to better serve ads to our visitors, cookies are used on Mydatabasesupport.com. For more information, check out our Privacy Policy.