When you create a database, the database server creates the following four dbspaces:
dbspace name |
Contents |
Default operating system file name |
---|---|---|
IQ_SYSTEM_MAIN |
Main (permanent) IQ Store file |
dbname.iq |
IQ_SYSTEM_TEMP |
Temporary IQ Store file |
dbname.iqtmp |
IQ_SYSTEM_MSG |
Message log file |
dbname.iqmsg |
SYSTEM |
Catalog Store file |
dbname.db |
The SYSTEM dbspace contains the system tables, which hold the schema definition as you build your database. It also holds a separate checkpoint log, rollback log, and optionally a write file, transaction log, and transaction log mirror, for the Catalog Store.
In addition to these database files, the database server also uses a temporary file to hold information needed during a session. This temporary file is not the same as the Temporary IQ Store, and is not needed once the database server shuts down. The file has a server-generated name with the extension .tmp. Its location is determined by the TEMP environment variable, or the ASTMP environment variable on UNIX.
Once the database is created, you can connect to it and build the tables and other objects that you need in the database.
In order to create a database using SQL statements, you must:
Start the database server
Start DBISQL
To create a database in DBISQL, you need to connect to an existing database, or else start the utility database, a phantom database with no database files and no data. You must start the utility database before creating new databases if no databases are built yet.
You can start the utility database in any of these ways:
Start the database server without a database by
specifying only -n enginename
on
the startup command.
Start dbisql from the command line, setting the Database Name to utility_db in the connection string, as in:
dbisqlc -c "uid=dba;pwd=sql;eng=myserver;dbn=utility_db;...
(You must not specify it as the Database File, because utility_db has no database file.)
In Sybase Central, in the Create Database Wizard, choose Utility Server as the engine that will create the database.
For more information on the utility database and its security, see“Utility database server security”.
If you are creating an IQ database for the first time, see the Introduction to Sybase IQ for assistance.
If the server is started with the -m server option, you cannot create a database.
When you create a database, you specify its location. Before you do so, consider whether you will ever need to move the database.
The IQ Catalog (.db) and transaction log (.log) files can be safely moved. Never attempt to copy a running database. If you use relative pathnames to create the database, then you can move the files by shutting down the server and using the operating system copy file command. If you use absolute (fully qualified) pathnames to create the database, then you must move the files by using the BACKUP command to make a full backup, and the RESTORE command with the RENAME option to restore the backup. See Chapter 14, “Backup and Data Recovery” for more information.
IQ dbspaces on raw partitions can be moved to other partitions while the database is shut down. The new partition must be at least as large as the current dbspace size. The new partition must also have the same path in order for the dbspace to start.
WARNING! When you allocate file system files for dbspaces (System, IQ Main or IQ Temporary), do not place the files on a file system that is shared over a local area network. This leads to poor I/O performance, can overload the local area network, and can lead to problems in the dbspace file. On UNIX platforms, avoid Network File System (NFS) mounted file systems. On Windows platforms, do not place dbspace files on Network Drives owned by another node.
If your IQ requirements are large and complex enough that you need multiple physical systems, consider using Sybase IQ multiplex functionality. See “Multiplex capability” for an overview.
Sybase IQ servers cannot manage databases created with versions prior to Sybase IQ 12.4.3; likewise, old servers cannot manage new databases.
To create an IQ database in Sybase Central, select the Sybase IQ plug-in, click the Utilities tab, then double-click Create Database. The Create Database Wizard leads you through the process. For a multiplex database, see “Creating databases with multiplex functionality”. For a nonmultiplex database, see “Creating databases” in Chapter 4, “Managing Databases,” in Introduction to Sybase IQ.
You can use the CREATE DATABASE statement to create IQ databases. You must specify the filename for Catalog Store and the IQ PATH. All other parameters are optional. If you use all of the defaults, your database has these characteristics:
Case sensitive (CASE RESPECT).’ABC’ compares NOT EQUAL to ‘abc’. Note that the default login is now user ID DBA and password SQL (uppercase). By default, passwords are case sensitive for a case-sensitive database, and case-insensitive for a case-insensitive database. User names are always case insensitive.
Catalog page size of 4096 bytes (PAGE SIZE 4096).
When comparing two character strings of unequal length, IQ treats the shorter one as if it were padded with blanks to the length of the longer one, so that ‘abc’ compares equal to ‘abc’ (BLANK PADDING ON).
Incompatible with Adaptive Server Enterprise.
IQ page size is 128KB (IQ PAGE SIZE 131072).
IQ message file and IQ Temporary Store are in the same directory as the Catalog Store. See also “Using relative pathnames.”
For a raw device, IQ SIZE and TEMPORARY SIZE are the maximum size of the raw partition. For operating system files, see the discussion of this parameter below.
IQ Temporary Store size is half the IQ size.
jConnect JDBC driver is enabled (JCONNECT ON).
The collation ISO_BINENG is used. The collation order is the same as the order of characters in the ASCII character set. In a case-sensitive database, all uppercase letters precede all lowercase letters (for example, both 'A' and 'B' precede 'a').
IQ RESERVE and TEMPORARY RESERVE are 0.
Unless CREATE DATABASE commands include CASE IGNORE or PASSWORD CASE IGNORE, connections to newly created databases must be made with case-sensitive user ID/password combinations.
For a full description of all parameters, see the CREATE DATABASE statement in the Sybase IQ Reference Manual. Following are several examples of creating an IQ database.
You can create a database using a relative or fully qualified pathname for each of the files for the database. Sybase recommends that you create databases with relative pathnames. If you specify absolute pathnames, you will not be able to move files to a different pathname without backing up and restoring the database.
If your database is on UNIX, you can define a symbolic link for each pathname, as described in the Sybase IQ Reference Manual.
If you omit the directory path, Sybase IQ locates the files as follows:
The Catalog Store is created relative to the working directory of the server.
The IQ Store, Temporary Store, and message log files are created in the same directory as, or relative to, the Catalog Store.
The Transaction Log is created in the same directory as the Catalog Store. (This also occurs if you do not specify any file name.) However, you should place it on a different physical device from the Catalog Store and IQ Store, on the same physical machine.
You must start the database server from the directory where the database is located, for any database created with a relative pathname. Using a configuration file to start the server ensures that you start the server from a consistent location.
The required IQ PATH parameter tells Sybase IQ that you are creating an IQ database, not an Anywhere database. You specify the location of your IQ Store in this parameter.
Choose a location for your database carefully. Although you can move an IQ database or any of its files to another location, to do so you must shutdown the database and you may have to perform a backup and restore.
You can add space on a different drive, as described in “Adding dbspaces” but you can only use this additional space for new data. You cannot readily move a particular table, index, or rows of data from one location to another. You would need to drop the table or index, recreate it, and reload it; or you would need to delete those rows, and reinsert them.
Each operating system has its own format for raw device names.
UNIX Platform |
Example |
---|---|
AIX |
/dev/rraw121v |
HP-UX |
/dev/vg03/rrchee12g |
Sun Solaris |
/dev/rsd0c |
Device type |
Name format required |
Example |
---|---|---|
Partitioned |
Letter assigned to that partition |
\\.\C: |
Not partitioned |
PhysicalDriveN, where N is a number starting with 0 and going as large as needed. You can find the physical drive numbers by running Disk Administrator in Administrative Tools. |
\\.\ PhysicalDrive32 |
On Windows systems, when you specify device names that include a back slash, you may need to double the back slash; see to keep the system from mistaking a backslash/letter combination for an escape sequence such as tab or newline command. This is controlled by the Escape_character option in SYSOPTIONS. For details, see your Sybase IQ Installation and Configuration Guide.
The following statement creates an IQ database called company.db. This database consists of four files:
The Catalog Store is in company.db, in the directory where the server was started (in this case, c:\company)
The IQ Store is in c:\company\iqdata\company.iq
The Temporary Store is in c:\company\company.iqtmp
The IQ message log file is in c:\company\company.iqmsg
CREATE DATABASE 'company.db' IQ SIZE 200 IQ PATH 'c:\\company\\iqdata\\company.iq'
The following statement creates an IQ database called company.db. This database consists of four UNIX files:
The Catalog Store is in company.db, in the directory where the server was started (in this case, /disk1/company)
The IQ Store is in /disk1/company/iqdata/company.iq
The Temporary Store is in /disk1/company/iqdata/company.iqtmp
The IQ message log file is in /disk1/company/iqdata/company.iqmsg
CREATE DATABASE 'company.db' IQ SIZE 2000 IQ PATH '/disk1/company/iqdata/company.iq'
The following UNIX example creates an IQ database called company with a raw partition for IQ PATH.
CREATE DATABASE 'company' IQ PATH '/dev/rdsk/c0t0d0s0'
The following Windows example creates an IQ database called company with a raw partition for IQ PATH.
CREATE DATABASE 'company' IQ PATH '\\.\D:'