Naming Database Objects

Naming Database Objects
• Names must be from 1 to 30 bytes long with these
exceptions:
– Names of databases are limited to 8 bytes
– Names of database links can be as long as 128
bytes
• Nonquoted names cannot be Oracle reserved
words.
• Nonquoted names must begin with an alphabetic
character from your database character set.
Naming Database Objects
When you name an object in the database you have the option of enclosing names in double
quotation marks ("). If you do this then you can break several of the naming rules mentioned in the
slide. However this is not recommended, because if you name an object this way you must always
refer to it with the quotes around the name. For example, if you name a table "Local Temp" you
must do the following:
SQL> select * from "Local Temp";
TEMP_DATE LO_TEMP HI_TEMP
--------- ---------- ----------
01-DEC-03 30 41
If you mistype the case you will get:
SQL> select * from "local temp";
select * from "local temp"
*
ERROR at line 1:
ORA-00942: table or view does not exist
Nonquoted names are stored in uppercase and are not case sensitive. When a SQL statement is
processed, nonquoted names are converted to all uppercase.
Oracle Database 10g: Administration Workshop I 8-8
8-8 Copyright © 2004, Oracle. All rights reserved.
Naming Database Objects
• Nonquoted names can contain only
– Alphanumeric characters from your database
character set
– The underscore (_)
– Dollar sign ($)
– Pound sign (#)
• No two objects can have the same name within the
same namespace
Naming Database Objects (continued)
Nonquoted identifiers can contain only alphanumeric characters from your database character set
and the underscore (_), the dollar sign ($), and the pound sign (#). Database links can also contain
periods (.) and the “at” sign (@). You are strongly discouraged from using $ and # in nonquoted
identifiers.
Quoted identifiers can contain any characters and punctuations marks as well as spaces. However,
neither quoted nor nonquoted identifiers can contain double quotation marks.
Oracle Database 10g: Administration Workshop I 8-9
8-9 Copyright © 2004, Oracle. All rights reserved.
Schema Object Namespaces
The following have their
own namespace:
• Indexes
• Constraints
• Clusters
• Database triggers
• Private database
links
• Dimensions
The following are in the
same namespace:
• Tables
• Views
• Sequences
• Private synonyms
• Stand-alone
procedures
• Stand-alone stored
functions
• Packages
• Materialized views
• User-defined types
Schema Object Namespaces
The Oracle database uses namespaces to resolve schema object references. When you refer to an
object in a SQL statement, Oracle considers the context of the SQL statement and locates the
object in the appropriate namespace. After locating the object, Oracle performs the operation
specified by the statement on the object. If the named object cannot be found in the appropriate
namespace, then Oracle returns an error.
Because tables and views are in the same namespace, a table and a view in the same schema
cannot have the same name. However, tables and indexes are in different namespaces. Therefore, a
table and an index in the same schema can have the same name.
Each schema in the database has its own namespaces for the objects it contains. This means, for
example, that two tables in different schemas are in different namespaces and can have the same[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/95530/viewspace-1023313/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/95530/viewspace-1023313/

When the `enable_ddl_logging` parameter is set to `TRUE` using the command `ALTER SYSTEM SET enable_ddl_logging = TRUE;`, the database system starts logging a subset of data definition language (DDL) statements. These logged statements are written to a dedicated log file known as the DDL log file. This log file follows the same format and general behavior as the alert log file, but it exclusively captures DDL statements executed in the database [^1]. The DDL log file contains detailed information about DDL commands such as `CREATE`, `ALTER`, and `DROP`, which modify the structure of database objects. By enabling this feature, database administrators can track and audit structural changes made to the database, which is particularly useful for troubleshooting, compliance, and operational monitoring purposes [^1]. When `enable_ddl_logging` is set to `TRUE`, the DDL command details are recorded in the DDL log file, and they are not removed from the alert log file. This means that the alert log may also contain entries related to DDL operations, but the DDL log file provides a more focused view of these changes [^1]. The location and naming convention of the DDL log file are typically determined by the database configuration and the logging framework in use. In some environments, the DDL log file might be named something like `log.xml` or follow a similar naming pattern based on the alert log's name, ensuring that it is easily identifiable and accessible for review [^1]. ### Example of DDL Logging Behavior When `enable_ddl_logging` is enabled, a command like the following: ```sql CREATE TABLE example_table (id NUMBER, name VARCHAR2(50)); ``` would be recorded in the DDL log file, providing visibility into the creation of the table `example_table`. ### Summary - Setting `enable_ddl_logging` to `TRUE` enables logging of DDL statements. - DDL commands are logged in a dedicated DDL log file. - The DDL log file has the same format and behavior as the alert log file but contains only DDL statements. - This logging mechanism supports auditing and tracking of structural changes in the database .
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值