force full statistic on single table not all db - oracle

I'm in need to force a full statistic on a table on a oracle 10g DB
On 11g I can use DBMS_STATS.SET_TABLE_PREFS and set ESTIMATE_PERCENT to 100.
How can I do the same over a 10g Oracle DB?
Thanks

There is no method available in Oracle 10g, which you can use to control the default value for some parameters for statistics collection.
The DBMS_STATS.SET_PARAM procedure, can be used to set the values for few defined parameters, but they are cannot be enforced on a specific table, but are applicable for all tables, post their invocation.
You will have to specify the estimate_percent as a parameter while gathering stats for your table, as an individual statement (maybe executed, post GATHER_SCHEMA_STATS)

Related

In Oracle 19c database, when we drop a table what happens to the procedures, triggers, index that uses this table?

In Oracle 19c database, when we drop a table what happens to the procedures, triggers, index that uses this table?
Will the triggers, procedures, index gets dropped automatically or
will it become INVALID status?
I want to know what is the correct process that needs to be
followed while dropping the table when you know you already have
the triggers, procedures, index associated with that particular
table?
Please help me out.
Indexes and triggers on the table will be dropped (as will grants)
Synonyms and views will become invalid
Hard-coded references to the table in procedures, packages, functions and triggers will make them invalid. References via dynamic SQL won't result in invalidation, but would fail when executed.
Query the DBA_DEPENDENCIES view to see which objects have dependencies and will get invalidated. There can be knock on impacts (dropping a table invalidates a procedure and a package that calls that procedure will be invalidated even if it doesn't reference the table directly).
If all usages are within the same user/schema, you can query USER_DEPENDENCIES instead. Don't bother with ALL_DEPENDENCIES view as, if another user has created objects referencing the victim table, you might not have privileges to see that object anyway.

How to change table monitoring setting

I'm working on improving Oracle tables' performances.
The table that I have been working on created with 'monitoring' and 'logging' clause. These two, decreasing performance of query and I need to change monitoring to nomonitoring(without dropping tables).
This is working well:
alter table some_table nologging
But to alter monitoring to nomonitoring I use;
alter table some_table nomonitoring
query executes without any errors but there is no change in table structure.
I've been researching on internet for days and also as I saw here there is no such topic for my specific problem.
Thanks in advance.
The monitoring/nomonitoring options are deprecated and are no longer used in Oracle.
Quote from the Oracle 11.2 manual
Formerly, you enabled DBMS_STATS to automatically gather statistics for a table by specifying the MONITORING keyword in the CREATE (or ALTER) TABLE statement. Starting with Oracle Database 11g, the MONITORING and NOMONITORING keywords have been deprecated and statistics are collected automatically. If you do specify these keywords, they are ignored.
(Emphasis mine)

Set Character sets for All Oracle Databases

I'm using Oracle Database 12c on RHEL System, and I wanna to set the parameters NLS_CHARACTERSET=AL32UTF8 and NLS_NCHAR_CHARACTERSET=AL16UTF16 by default for all created databases with sql create statement to avoid to add them every time when I issue the create query.
I have tried to add these parameters to initSID.ora but it seems they are not valid as initialization parameters.
Thanks.

INSERT ALL INTO a table over a dblink .. Is it possible?

When I execute the following:
INSERT ALL INTO table#database_link(columnName) VALUES (columnValue)
SELECT columnValue FROM localTable;
I get an error
SQL Error: ORA-02021: DDL operations are not allowed on a remote
database
02021. 00000 - "DDL operations are not allowed on a remote database"
*Cause: An attempt was made to use a DDL operation on a remote database.
For example, "CREATE TABLE tablename#remotedbname ...".
*Action: To alter the remote database structure, you must connect to the
remote database with the appropriate privileges.
Note that when I do a regular (not an insert ALL into) ... the insert works over the database link. (Grants are valid).
There are also NO triggers on either tables.
And I explicitly need the INSERT ALL INTO, to allow for the ability to insert into multiple tables.
Are INSERT ALL INTO operations not allowed into database link tables?
This message is a little misleading but anyway according to the Oracle SQL Reference
You cannot perform a multitable insert into a remote table.
Are INSERT ALL INTO operations not allowed into database link tables?
Unfortunately not. Note the second item in this list:
Restrictions on Multitable Inserts
You can perform multitable inserts only on tables, not on views or
materialized views.
You cannot perform a multitable insert into a remote table.
You cannot specify a table collection expression when performing a
multitable insert.
In a multitable insert, all of the insert_into_clauses cannot combine
to specify more than 999 target columns.
Multitable inserts are not parallelized in a Real Application Clusters
environment, or if any target table is index organized, or if any
target table has a bitmap index defined on it.
Plan stability is not supported for multitable insert statements.
The subquery of the multitable insert statement cannot use a sequence.
Source: Oracle 9i documentation

Oracle Analyze Table command

Is the command Analyze table tbl compute statistics a DDL or DML? Intuitively, it seems to be neither.
When i have this command in a .sql file do i need to do :
execute immediate 'Analyze table tbl compute statistics'
I have a smiliar question about the command: GRANT DELETE, INSERT, SELECT, UPDATE ON tbl to user
UPDATE Oracle says that both grant and analyze are Data Definition Language (DDL) statements. They apparently do not make a distinction between DDL and Data Control Language (DCL).
If executing from within PL/SQL, then either execute immediate or DBMS_SQL would be needed.
Also, "Do not use the COMPUTE and ESTIMATE clauses of ANALYZE to collect optimizer statistics. " (10gR2) "For the collection of most statistics, use the DBMS_STATS
package. ... Use the ANALYZE statement (rather than DBMS_STATS)
for statistics collection not related to the cost-based
optimizer." (11g R2) Analyze table is deprecated for gathering optimizer statistics, though still usefull for other things. Use DBMS_STATS instead. (I linked to the online Oracle documentation for 10g R2. However I've been having trouble with Oracle's documenation site the last few days, with the 10g R2 documents disappearing and then reappearing.)

Resources