Restore database improve code


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Restore database improve code
Prev   Next
# 2  
Old 04-21-2020
Quote:
Originally Posted by mustfirst
let me know if you can suggest any improvement in my code. I think i have too many ECHO.
.
.
.
Yes, definitely. After running this 10 times, you'll be fed up with its verbosity and scrap all the output except for error messages. *nix philosophy: no news is good news.
You may want to better structure your code. You've done some block building, yes, but e.g. indenting might improve readability and understandability for future you, and others.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Improve awk code that has three separate parts

I have a very inefficient awk below that I need some help improving. Basically, there are three parts, that ideally, could be combined into one search and one output file. Thank you :). Part 1: Check if the user inputted string contains + or - in it and if it does the input is writting to a... (4 Replies)
Discussion started by: cmccabe
4 Replies

2. Programming

Improve the performance of my C++ code

Hello, Attached is my very simple C++ code to remove any substrings (DNA sequence) of each other, i.e. any redundant sequence is removed to get unique sequences. Similar to sort | uniq command except there is reverse-complementary for DNA sequence. The program runs well with small dataset, but... (11 Replies)
Discussion started by: yifangt
11 Replies

3. Solaris

Restore a database on solaris..

hi All, Can anyone help me with the set of commands which are used to restore maybe a sybase database on solaris.. (1 Reply)
Discussion started by: sankasu
1 Replies

4. AIX

mksysb restore - Wrong OS level for restore

Hi all, I am still working on my mksysb restore. My latest issue is during an alt_disk_install from tape I got the following error after all the data had been restored. 0505-143 alt_disk_install: Unable to match mksysb level 5.2.0 with any available boot images. Please correct this... (0 Replies)
Discussion started by: pobman
0 Replies
Login or Register to Ask a Question
CREATE 
DATABASE(7) SQL Commands CREATE DATABASE(7) NAME
CREATE DATABASE - create a new database SYNOPSIS
CREATE DATABASE name [ [ WITH ] [ OWNER [=] dbowner ] [ LOCATION [=] 'dbpath' ] [ TEMPLATE [=] template ] [ ENCODING [=] encoding ] ] INPUTS name The name of a database to create. dbowner Name of the database user who will own the new database, or DEFAULT to use the default (namely, the user executing the command). dbpath An alternate file-system location in which to store the new database, specified as a string literal; or DEFAULT to use the default location. template Name of template from which to create the new database, or DEFAULT to use the default template (template1). encoding Multibyte encoding method to use in the new database. Specify a string literal name (e.g., 'SQL_ASCII'), or an integer encoding num- ber, or DEFAULT to use the default encoding. OUTPUTS CREATE DATABASE Message returned if the command completes successfully. ERROR: user 'username' is not allowed to create/drop databases You must have the special CREATEDB privilege to create databases. See CREATE USER [create_user(7)]. ERROR: createdb: database "name" already exists This occurs if a database with the name specified already exists. ERROR: database path may not contain single quotes The database location dbpath cannot contain single quotes. This is required so that the shell commands that create the database directory can execute safely. ERROR: CREATE DATABASE: may not be called in a transaction block If you have an explicit transaction block in progress you cannot call CREATE DATABASE. You must finish the transaction first. ERROR: Unable to create database directory 'path'. ERROR: Could not initialize database directory. These are most likely related to insufficient permissions on the data directory, a full disk, or other file system problems. The user under which the database server is running must have access to the location. DESCRIPTION
CREATE DATABASE creates a new PostgreSQL database. Normally, the creator becomes the owner of the new database. Superusers can create databases owned by other users using the OWNER clause. They can even create databases owned by users with no special privileges. Non-superusers with CREATEDB privilege can only create databases owned by themselves. An alternate location can be specified in order to, for example, store the database on a different disk. The path must have been prepared with the initlocation [initlocation(1)] command. If the path name does not contain a slash, it is interpreted as an environment variable name, which must be known to the server process. This way the database administrator can exercise control over locations in which databases can be created. (A customary choice is, e.g., PGDATA2.) If the server is compiled with ALLOW_ABSOLUTE_DBPATHS (not so by default), absolute path names, as identified by a leading slash (e.g., /usr/local/pgsql/data), are allowed as well. By default, the new database will be created by cloning the standard system database template1. A different template can be specified by writing TEMPLATE = name. In particular, by writing TEMPLATE = template0, you can create a virgin database containing only the standard objects predefined by your version of PostgreSQL. This is useful if you wish to avoid copying any installation-local objects that may have been added to template1. The optional encoding parameter allows selection of the database encoding, if your server was compiled with multibyte encoding support. When not specified, it defaults to the encoding used by the selected template database. Optional parameters can be written in any order, not only the order illustrated above. NOTES CREATE DATABASE is a PostgreSQL language extension. Use DROP DATABASE [drop_database(7)] to remove a database. The program createdb [createdb(1)] is a shell script wrapper around this command, provided for convenience. There are security and data integrity issues involved with using alternate database locations specified with absolute path names, and by default only an environment variable known to the backend may be specified for an alternate location. See the Administrator's Guide for more information. Although it is possible to copy a database other than template1 by specifying its name as the template, this is not (yet) intended as a general-purpose COPY DATABASE facility. We recommend that databases used as templates be treated as read-only. See the Administrator's Guide for more information. USAGE
To create a new database: olly=> create database lusiadas; To create a new database in an alternate area ~/private_db: $ mkdir private_db $ initlocation ~/private_db The location will be initialized with username "olly". This user will own all the files and must also own the server process. Creating directory /home/olly/private_db Creating directory /home/olly/private_db/base initlocation is complete. $ psql olly Welcome to psql, the PostgreSQL interactive terminal. Type: copyright for distribution terms h for help with SQL commands ? for help on internal slash commands g or terminate with semicolon to execute query q to quit olly=> CREATE DATABASE elsewhere WITH LOCATION = '/home/olly/private_db'; CREATE DATABASE COMPATIBILITY
SQL92 There is no CREATE DATABASE statement in SQL92. Databases are equivalent to catalogs, whose creation is implementation-defined. SQL - Language Statements 2002-11-22 CREATE DATABASE(7)