Oracle Library and date format usage

Source: Internet
Author: User
Tags create index dba disk usage oracle database sqlplus

Oracle Library and date format usage

Install Oracle Instance name orcl,system password system
/* Build the Library step:
1. Install the Oracle database tutorial, fill out the instance name ORCL, and end the instance database after it is created.
2. The system operation input cmd carriage return opens the Command window, enters the command sqlplus, enters the user name SYSTEM/SYSTEM@ORCL carriage return login, the input command start D:ksxt.sql (d:ksxt.sql is this file path)
Carriage return execution. Auto End
The command window is as follows:
C:usersadministrator>sqlplus
Please enter user name: SYSTEM/SYSTEM@ORCL
Sql>start D:ksxt.sql
3. Modify the ksxt2448 in the program file Web.config as ksxtpwd.
4. Successful deployment, test procedures.
*/
--Log on, log on with system before creating a user
Conn SYSTEM/SYSTEM@ORCL;
--Create a temporary table space
Create temporary tablespace ksxt_temp tempfile ' d:oracleproduct10.2.0oradatatestserverksxt_temp01.dbf '
Size 32m
Autoextend on
Next 32m MaxSize 2048m
Extent management Local;

--Create a table space
Create Tablespace KSXT
Logging--with nologging and logging two options, create a redo log when creating a tablespace
DataFile ' d:oracleproduct10.2.0oradatatestserverksxt01.dbf ' size 32m--datafile is used to specify the exact location and size of the data file. If you have multiple files, you can separate them with commas, However, each file needs to indicate the size. must be an absolute address and cannot use a relative address.
Autoextend on
Next 32m MaxSize 2048m
Extent management local--extent management The regional storage management method, native management: Managing disks in a binary way, with high efficiency and maximum disk usage. At the same time, it can automatically track the situation of the adjacent free space and avoid the merging operation of the free zone.
Uniform SEGMENT Space MANAGEMENT--disk extension management method: SEGMENT space MANAGEMENT: Use this option time zone size is determined automatically by the system. Because Oracle can determine the optimal size of each zone, the zone size is variable. Uniform SEGMENT Space MANAGEMENT: Specify the size of the zone, or use the default value (1 MB).
Auto--Segment space management mode: Auto: Can only be used in a locally managed tablespace. When you use the Local management table space, the new state is reflected in the bitmap as the free space in the block increases or decreases. Bitmaps automate the behavior of Oracle to manage free space and provide better management of free space, but cannot be automatically managed for tables that contain LOB fields. MANUAL: No longer available, mainly for backwards compatibility.
;
--Create a user and specify a table space
Create user ksxt/*username*/identified by ksxt2448/*password*/
Default Tablespace KSXT
Temporary tablespace ksxt_temp;

--Granting permissions to users
Grant CONNECT,RESOURCE,DBA to ksxt;--three system permission group connect connect only resource development, application Resources DBA Administrator
--After you log on as that user, any database objects you create are part of the ksxt_temp and KSXT tablespaces, so you don't have to specify the tablespace for each object you create.
--Log on using the created user
Conn KSXT/KSXT@ORCL;
--Import data
--imp KSXT/KSXT2448@ORCL file=c:/ksxt.dmp full=y ignore=y; --dmp file Import
Start D:ksxt.sql; --sql File Statement Import

--To create a sequence, you first need to have create sequence, or create any sequence permission, 
--Example:
/*
Create sequence emp_sequence -- Sequence name
     increment by 1  --add a few  
     start each time With 1    --counting starting from 1  
     nomaxvalue       --Do not set maximum value  
     nocycle          --cumulative, not looping  
     Cach 10;     --Cache size
  */
Create sequence Kstmb_sqs
MinValue 1
MaxValue 999999999999999999999999999
start with 2
Increment by 1
Cache

Create sequence Storydata_sqs
MinValue 1
MaxValue 999999999999999999999999999
Start with 2
Increment by 1
Cache 20
Order
--Create an index that checks to see if an indexed creation statement is included in the exported SQL file, and do not repeatedly create
/*
Create INDEX index_kstmb_1 on KSTMB (SJBM, STLX, STBM)
Tablespace KSXT
Pctfree 10
Initrans 2
Maxtrans 255
Storage
(
Initial 64K
Minextents 1
Maxextents Unlimited
);

Create INDEX storydata_index_1 on Storydata (STBM, Timeid)
Tablespace KSXT
Pctfree 10
Initrans 2
Maxtrans 255
Storage
(
Initial 64K
Minextents 1
Maxextents Unlimited
);
*/

In fact

Oracle date format INSERT INTO Ecp_chat_message (chatid,content,imgurl,senduserid,sendtime,receiveuserid,state,isread)
VALUES (1, ' asdfdf ', ' aaaa ', ' Kehu4 ', to_date (' 2011-12-03 12:55:45.333333 ', ' yyyy-mm-dd hh24:mi:ss.ff '), ' Serviceid ', 1,0)

The error is as follows:

Date format picture ends before converting the entire input string

Inserted into the second can be written like this,

Insert into Ecp_chat_message (chatid,content,imgurl,senduserid,sendtime,receiveuserid,state,isread)
VALUES (1, ' asdfdf ', ' aaaa ', ' Kehu4 ', to_date (' 2011-12-03 12:55:45 ', ' yyyy-mm-dd hh24:mi:ss '), ' Serviceid ', 1,0)

The millisecond level is going to work.

Insert into Ecp_chat_message (chatid,content,imgurl,senduserid,sendtime,receiveuserid,state,isread)
VALUES (1, ' asdfdf ', ' aaaa ', ' Kehu4 ', To_timestamp (' 2011-12-03 12:55:45.333333 ', ' yyyy-mm-dd hh24:mi:ss.ff '), ' Serviceid ', 1,0)

This style of writing, while noting that the database field to be changed to timestamp type

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.