Oracle alter tablespace
1. Find out which tables have incorrect tablespaces.
select * from dba_tables where tablespace_name='TDB';2. Move the tablespace in TDB to TDB2009.
Syntax: alter table table_name move tablespace tablespace_name; alter table tdb2009.ASSOC _ INFO move tablespace TDB2009; alter table tdb2009.BGUSER
Change Database Name
(1)
Alter database database_name
Modify name = new_database_name
(2)
Sp_renamedb olddbname, newdbname
Add data files and file groups (expand)
(1) Add a data file
USE master
GO
DECLARE @ data_path nvarchar (256 );
-- Obtain the storage location of the primary data file
SELECT @ data_path = physical_name
FROM MyDatabase. sys. database_files
WHERE file_id = 1;
SET @ data_path = SUBSTRING (@ data_path, 1, CHARINDEX (LOWER ('mydatabase
SQL ALTER TABLE statements are important in PHP operations and will be explained in this article.
SQL ALTER TABLE Syntax
To add columns to a table, use the following syntax:
ALTER TABLE table_nameADD column_name datatype
To delete a column from a table, use the following syntax:
ALTER TABLE table_nameDROP COLUMN colum
DB2 alter: Add/delete/Reset Column
1. Add Fields
Alter table [table_name] add [column_name] [column_type]
2. Change the field type
Alter table [table_name] alter column [column_name] Set Data Type [column_type]
Note: There are restrictions on changing the field type. For example, you can change the field to be lar
A collection of SQL statements for the ALTER TABLE of MySQL, including adding, modifying, deleting fields, renaming tables, adding, deleting primary keys, and so on.
1: Delete Column
ALTER table "table name" DROP "column name"
2: Adding columns
ALTER table "table name" ADD "column name" INT not NULL COMMENT ' annotation description '
3: Modify the column's t
Label:ALTER TABLE StatementThe ALTER table statement is used to add, modify, or delete columns in an existing table.SQL ALTER TABLE SyntaxTo add columns to a table, use the following syntax: ALTER TABLE table_name
ADD column_name datatype
To delete a column from a table, use the following syntax: ALTER TABLE table_nam
I recently studied sqlserver database .. I have not been familiar with it for a long time. I often encounter some alter statements, and I have learned some about it in my spare time. the following example uses the table structure createdatabaseText_DBgouseText_DBgocreatetableTeacher (
I recently studied sqlserver database .. I have not been familiar with it for a long time. I often encounter some alter stat
-- ===================================================== ====================================
Event cause: the Development finds that the data inserted to the table fails. After viewing the event, it finds that the int Type Auto-increment value has reached the maximum value and the data cannot be inserted. You need to change the int type to the bigint type.
-- ===================================================== ====================================
As a group of old DBAs who think they are some
Create a new table (using the structure of the current table) with the new column (s) included.
Execute aINSERT INTO new_table SELECT (column1,..columnN) FROM current_table;
Rename the current table
Rename the new table using the name of the current table.
1. CREATE TABLE new_table LIKE table;2. INSERT INTO new_table SELECT * FROM table;34.RENAME TABLE table = old_table, table = new_table;
The usual trick for loading MyISAM table efficiently are to disable keys, load th
Because of the high IO wait when the database is importing large amounts of data, the new storage cannot be hung directly, consider using an NFS mount, and then store redo to ease io pressure.Database version InformationSql> select * from V$version;BANNER----------------------------------------------------------------Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-64biPl/sql Release 10.2.0.4.0-productionCORE 10.2.0.4.0 ProductionTNS for Ibm/aix RISC system/6000:version 10.2.0.4.0-produ
To change the default value of a large table, use alter table instead of recreating the table. frm executes most of the modification operations in mysql. It needs to recreate a table, put the data in it, and delete the old table! Sometimes, when there are a large number of indexed columns and frequent tables, the system performance will be seriously degraded. Here, you can make some adjustments on modifying the SQL statement, reduce the system pressur
When modifying the SQL Server table structure, use the ALTER statement to enumerate some commonly used alter statements as follows.1: Add a field to the tableAlter table [table name] add [column name] Type2: Delete FieldAlter table [table name] Drop column [column name]3: Modify the field type in the table (you can modify the type of the column, whether it is empty)ALTE
Number"4, df.checkpoint_change# "Checkpoint"5, df.name "file name"6 from V$tablespace Ts,v$datafile DF7 where ts.ts#=df.ts#8 ORDER by df.file#;Table space name file number checkpoint file name------------------------------ ---------- ---------- ----------------------------------------SYSTEM 1 708505/oracle/oradata/boss/system01.dbfUNDOTBS1 2 708505/oracle/oradata/boss/undotbs01.dbfSysaux 3 708505/oracle/oradata/boss/sysaux01.dbfUSERS 4 708505/ORACLE/ORADATA/BOSS/USERS01.DBFEXAMPLE 5 708505/orac
Number"4, df.checkpoint_change# "Checkpoint"5, df.name "file name"6 from V$tablespace Ts,v$datafile DF7 where ts.ts#=df.ts#8 ORDER by df.file#;Table space name file number checkpoint filename------------------------------ ---------- ---------- ----------------------------------------SYSTEM 1 708505/oracle/oradata/boss/system01.dbfUNDOTBS1 2 708505/oracle/oradata/boss/undotbs01.dbfSysaux 3 708505/oracle/oradata/boss/sysaux01.dbfUSERS 4 708505/ORACLE/ORADATA/BOSS/USERS01.DBFEXAMPLE 5 708505/oracl
Alter table tablename add (column datatype [default value] [null/not null],...);
Alter table tablename modify (column datatype [default value] [null/not null],...);
Alter table tablename drop (column );
Alter table is used to add, delete, and modify a column.
The following is an example:Create table test1(Id varcha
(There is an "Enterprise Manager Console" in the Windows Oracle Start Menu, which allows you to directly edit tablespaces and files)
Alter Database
Open an existing database, and/or modify associated files.
Syntax:
ALTER DATABASE database_name options
Options:
open/mount options: MOUNT MOUNT STANDBY DATABASE MOUNT CLONE DATABASE MOUNT PARALLEL MOUNT STANDBY DATABASE CONVERT OPEN [READ ONLY]
Prior to 11.1, many people might have known that Oracle database history passwords could be restored through alter user identified by values password, but several problems occurred in 11g:1. Dba_users no password record (null value), this problem can be directly queried User$.password still have recordsSql> Select password from dba_users where username= ' SYS ';PASSWORD------------------------------Sql> Select password from user$ WHERE name= ' SYS ';P
Tags: blog http using AR data SP log c HTMLAbout UPDATE and ALTER:Baidu knows about the update and alter has a very image of the summary: A table has a lot of fields, a field has a lot of data. A family has a lot of rooms, a room with a lot of furniture. Update is used to change the wardrobe to a bookshelf. Alter is used to change the kitchen into a toilet.Change the bedroom to a toilet:
ALTER TABLE Parse instance: sql:1. Add columns 2. Add columns, adjust column order 3. Increase the index 4. Increase the constraint 5. Increase the full-text index FULL-TEXT6. Change the default value of the column 7. Change the column name (type, order) 8. Do not change the column name 9. Delete Column 10. Delete the primary key 11. Delete Index 12. Change the character set Create a tableCREATE TABLE T1 (a integer,b CHAR (10));1. Add Column format:AD
Label:1: Delete column
ALTER TABLE "table name" DROP "column Name"
2: Add column
ALTER TABLE "table name" Add "column name" INT not NULL COMMENT ' comment description '
3: Modify Column The type information of the
ALTER table "table name" Change "column Name" "New column name (here you can use the same name as the original column)" BIGINT not NULL COMMENT
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.