cancel
Showing results for 
Search instead for 
Did you mean: 

Please add the appropriate DBINIT command in the "Create Database Wizard" and in reload.sql scripts

VolkerBarth
Contributor
5,740

I really like the v12 innovation that the Sybase Central Wizards have an additional page to display the generated tool command line.

But for the "Create Database Wizard", I would like to get the according DBINIT command (in addition to or instead of the CREATE DATABASE statement).

The same goes for the reload.sql script created by the "Unload Wizard" (and the DBUNLOAD utility): The reload.sql contains the according CREATE DATABASE statement as comment. Here, I would like to get the DBINIT command, too.

Reasoning:

When migrating databases, the CREATE DATABASE statement is usually the only statement that has to be run against the utility_db or another database. When working on production servers, connecting to the utility_db or a SA demo database is not always available. (And it usually takes some time (at least for me) to find an appropriate dummy database just in order to run CREATE DATABASE...).

Here, a DBINIT command seems much easier to use.

It's not too hard to manually translate a CREATE DATABASE statement to the DBINIT syntax but in newer versions the number of options has significantly increased (say, just for the NCHAR stuff).


EDIT:

According to John's answer, DBINIT itself connects to the utility_db internally. Then my reasoning against CREATE DATABASE w.r.t. to the possible unavailability of the utility_db on production servers is pointless: Apparently, DBINIT would then fail there, too. - But I still think that DBINIT is easier to use. - Corrected: As DBINIT starts its own engine, restrictions of a production engine (e.g. the -su option) won't apply...

Accepted Solutions (0)

Answers (1)

Answers (1)

johnsmirnios
Employee
Employee

dbinit just starts a new engine, connects to the utility_db on it and sends it a CREATE DATABASE statement.

It connects with the following connection string: UID=DBA;PWD=SQL;AUTOSTOP=yes;DBN=utility_db;ENG=dbinit_engine;START=dbeng12 -gp 4096 -c 10M;LINKS=SharedMemory;IGNORESQLCONNECT=YES

The -gp value should match the page size of the database.

-john.

Breck_Carter
Participant

How does that knowledge make it easy to create a database initialization command for, say, inclusion in a Windows command file? Are you suggesting a dbisql command with a CREATE DATABASE statement? Does Sybase Central let you do that with a simple copy and paste?

VolkerBarth
Contributor
0 Kudos

@John: IGNORESQLCONNECT - yet another undocumented connection parameter that was uncovered?

VolkerBarth
Contributor
0 Kudos

@Breck: That are my questions, too:)

johnsmirnios
Employee
Employee

Volker said connecting to a utility_db was not always available in a production environment and that's why he needed dbinit; however, connecting to a utility_db is exactly what dbinit does so it must be available.

I don't see any specific request for something to use in a command file but how about dbisql -c connection_string create database ...

For an install, you may have already implemented other means of connecting & executing SQL too.

johnsmirnios
Employee
Employee

IGNORESQLCONNECT is completely unnecessary. If it does actually need to be ignored, dbinit should just have cleared it in its own environment rather than implementing an option in the connection string parsing. I can't vouch for everyone's historical choices 🙂

VolkerBarth
Contributor
0 Kudos

@John: Ah, I just wasn't aware that DBINIT connects to the utility_db internally. Then, of course, my reasoning against CREATE DATABASE in the question is partly wrong - see my edits there.

johnsmirnios
Employee
Employee

I don't think dbinit would fail in that environment. I think you missed the fact that dbinit connects to an engine whose name is 'dbinit_engine'. There is nothing special about that name except that it is unlikely that an engine with that name will already be running. Effectively, dbinit just autostarts a new standalone server with the name 'dbinit_engine' and connects to the utility_db on it.