Wednesday, December 25, 2013

How to Create Database


Database is a structured set of data held in a computer, esp. one that is accessible in various ways. 
We can create DB in progress using different methods,
1.     Creating DB with structure file (.st)
2.     Creating DB with copy of other existing DB
3.     Restoring from a backed up DB
4.     creates a new database from a specified source database.

1. Creating DB with structure file (.st)
To create DB with structure file we need to know what exactly the Structure file means. Structure file is text file with .st extension, which contains the structure of Database.

What are the contents of .st file?
.st file mainly containing below details
·        The storage area type : indicates type of area ( a- after image, b- before image, t-transaction log, d- data are)
·        The area name : name of the storage area
·        The area number: Number of storage area (you can give number above 6 , till 6 will be default used by progress, if you did not give number prostrct will automatically give number).
·        The records per block : optional field numbers of records should be in a block (20 - 27) 
·        The number of blocks per cluster : optional field and this is for type2 area number of blocks per cluster values can be 1 8 64 512
·        The extent pathname: the path of extent where it stores physically.
·        The extent type: type of extent, variable(v) or fixed (f).

·        The extent size: size of fixed extent till when it can grow.



Sample .st file
b tests/largedb.b1 f 1048576
b tests/largedb.b2
#
a tests/largedb.a1 f 2097152
# SCHEMA AREA with a fixed length file of 3GB and a variable length file with
# a maximum size of 3GB.
#
d “Schema Area”:6,64 tests/largedb.d1 f 3145728
d “Schema Area”:6,64 tests/largedb.d2

Create Database with structure file

prostrct create <dbname> stfile.st –blocksize [1024|2048|4096| 8192] 


the above command will create void database to make it an empty database you have to copy the empty database to this.
In $DLC you can get the proper empty database if it is 1k blocksize DB name is empty, if it is 4k Db name is empty4. By default in openedge prostrct will create a DB of 8K blocksize. You can use below command to make void 8k Db to empty 8k DB
procopy $DLC/empty8 <db-name>


Creating DB with copy of other existing DB

If you want to have the copy of other database you can use procopy <source-db> <dest-db> your new Db will be created.


Restoring from a backed up DB

If you have a backep up database using probkup utility you can restore it by prorest command but you need to have .st file for this .

prorest dbname <dbname>.bkp

optionally you can use restore list
prorest dbname <dbname>.bkp < restore.list

if you are restoring on top of an existing db add "y" as the first line of restore.list.


No comments:

Post a Comment