方法/步骤
>01
打开受密码保护的工作表
>02
工具---宏----录制新宏---输入名字如:hh
>03
停止录制(这样得到一个空宏)
>04
工具---宏----宏,选hh,点编辑按钮
>05
删除窗口中的所有字符,替换为下面的内容:
Option Explicit Public Sub AllInternalPasswords() ' Breaks worksheet and workbook structure passwords Bob McCormick ' probably originator of base code algorithm modified for coverage ' of workbook structure / windows passwords and for multiple passwords ' ' Norman Harker and JE McGimpsey 27-Dec-2002 (Version 11) ' Modified 2003-Apr-04 by JEM: All msgs to constants, and ' eliminate one Exit Sub (Version 111) ' Reveals hashed passwords NOT original passwords Const DBLSPACE As String = vbNewLine & vbNewLine Const AUTHORS As String = DBLSPACE & vbNewLine & _ "Adapted from Bob McCormick base code by" & _ "Norman Harker and JE McGimpsey" Const HEADER As String = "AllInternalPasswords User Message" Const VERSION As String = DBLSPACE & "Version 111 2003-Apr-04" Const REPBACK As String = DBLSPACE & "Please report failure " & _ "to the microsoftpublicexcelprogramming newsgroup" Const ALLCLEAR As String = DBLSPACE & "The workbook should " & _ "now be free of all password protection, so make sure you:" & _ DBLSPACE & "SAVE IT NOW!" & DBLSPACE & "and also" & _ DBLSPACE & "BACKUP!, BACKUP!!, BACKUP!!!" & _ DBLSPACE & "Also, remember that the password was " & _ "put there for a reason Don't stuff up crucial formulas " & _ "or data" & DBLSPACE & "Access and use of some data " & _ "may be an offense If in doubt, don't" Const MSGNOPWORDS1 As String = "Th
1跟踪数据库空间增长
SELECT SUM(MB_ALLOC)/1024 GB_DB_SIZE FROM
(SELECT SUM(ROUND(bytes_used/(10241024),2) + ROUND(bytes_free/(10241024),2)) MB_ALLOC
FROM V$temp_space_header, dba_temp_files
WHERE V$temp_space_headerfile_id (+) = dba_temp_filesfile_id
UNION
SELECT SUM(BYTES)/(10241024) MB_ALLOC FROM dba_data_files);
2下面例子除了undo和temp表空间外,将其他表空间的的使用情况记录每周插入db_spaec_hist表,以便查询:
Create the table for database size history create table db_space_hist (
timestamp date,
total_space number(8),
used_space number(8),
free_space number(8),
pct_inuse number(5,2),
num_db_files number(5)
);
Create the procedure db_space_history CREATE OR REPLACE PROCEDURE db_space_history AS
BEGIN
INSERT INTO db_space_hist
SELECT SYSDATE, total_space,
total_space-NVL(free_space,0) used_space,
NVL(free_space,0) free_space,
((total_space - NVL(free_space,0)) / total_space)100 pct_inuse,
num_db_files
FROM ( SELECT SUM(bytes)/1024/1024 free_space
FROM sysDBA_FREE_SPACE WHERE tablespace_name NOT LIKE '%UNDO%') FREE,
( SELECT SUM(bytes)/1024/1024 total_space,
COUNT() num_db_files
FROM sysDBA_DATA_FILES WHERE tablespace_name NOT LIKE '%UNDO%') FULL;
COMMIT;
END;
/
Create the job that runs once in a week DECLARE
X NUMBER;
BEGIN
SYSDBMS_JOBSUBMIT
(
job => X
,what => 'SYSDB_SPACE_HISTORY;'
,next_date => TO_DATE('22/02/2008 19:40:28','dd/mm/yyyy hh24:mi:ss')
,INTERVAL => 'TRUNC(SYSDATE+7)'
,no_parse => FALSE
);
END;
3做周期性监控
select from db_space_hist order by timestamp desc;
4查询结果(每月数据库的增长情况),统计的出发条件为createion_time
SELECT TO_CHAR(creation_time, 'RRRR Month') "Month", round(SUM(bytes)/1024/1024/1024) "Growth in GBytes"
FROM sysv_$datafile
WHERE creation_time > SYSDATE-365
GROUP BY TO_CHAR(creation_time, 'RRRR Month');
Month Growth in GBytes
-------------- ----------------
2008 December 1331
2008 November 779
2008 October 447
2009 April 797
2009 August 344
2009 February 505
2009 January 443
2009 July 358
2009 June 650
2009 March 452
2009 May 1787
2009 October 255
2009 September 158
你这个程序问题多多,我给你改了一下,我讲一下我修改的思路:
然后,再验证你的Date类
再次,验证你的Time类,这和Date差不多
最后验证你的DateTime继承类,结果还是有问题。
其实你可以自己一步一步的修改的,C++的特点,只要你前面的确保正确,
那么出问题的只有下面的程序语句了,不懂的可以Hi我,我把修改的代码给你:
#include <iostreamh>
#include <stdioh>
#include <stringh>
char itoa(int n)//把数字转换为char,其中的new分配内存空间,否则出错
{
char c=new char;
int t = n;
int i = 0;
do
{
n = n / 10;
i++;
}while(n != 0);
c[i] = '\0';
for(i = i - 1; i >= 0; i--){
c[i] = t % 10 + 48;
t = t / 10;
}
return c;
}
//定义类
class Date
{
private:
int Year, Month, Day;
public:
Date(int year, int month, int day){
Year = year;
Month = month;
Day = day;
}
void SetDate(int year, int month, int day){
Year = year;
Month = month;
Day = day;
}
void GetDate(char a){
//char y[10], m[2], d[2];
char year=new char, month=new char, day=new char;
year=itoa(Year);
month=itoa(Month);
day=itoa(Day);
strcat(a, year);
strcat(a, "/");
strcat(a, month);
strcat(a, "/");
strcat(a, day);
}
};
//定义类
class Time
{
private:
int Hour, Minute, Second;
public:
Time(int hour, int minute, int second){
Hour = hour;
Minute = minute;
Second = second;
}
void SetTime(int hour, int minute, int second){
Hour = hour;
Minute = minute;
Second = second;
}
void GetTime(char b){
char hour=new char, minute=new char, second=new char;// h[5], m[3], s[3];
//hour = h;
//minute = m;
//second = s;
hour=itoa(Hour);
minute=itoa(Minute);
second=itoa(Second);
strcat(b, hour);
strcat(b, ":");
strcat(b, minute);
strcat(b, ":");
strcat(b, second);
}
};
//继承类
class DateTime: public Date, public Time
{
public:
DateTime(int year, int month, int day, int hour, int minute, int second): Date(year, month, day), Time(hour, minute, second)
{};
void SetDateTime(int year, int month, int day, int hour, int minute, int second){
SetDate(year, month, day);
SetTime(hour, minute, second);
}
void GetDateTime(char s){
char a=new char, b=new char;//, m[10], n[10];
// a = m;
//b = n;
a[0]='\0';
b[0]='\0';
GetDate(a);
GetTime(b);
strcat(s, a);
strcat(s,"--");
strcat(s, b);
}
};
//主函数
int main()
{
char a[40],s;
a[0]='\0';//针对strcat的特性需要
s=a;
DateTime p(2011,4,10,10,34,56);
pGetDateTime(s);
cout<<a<<endl;
return 0;
}
运行结果:
2011/4/10--10:34:56
Press any key to continue
有疑问可以百度HI我,只是粗略的改了一下
主要的错误是内存空间的分配,指针的指向,
错误的地方是字符数组出错了,strcat(a,b)用法是先找到a的\0,然后删除它在与b连接,如果a没有\0,就在a的结尾连接,还有就是分配内存空间出错了(指针的运用)
欢迎分享,转载请注明来源:浪漫分享网
评论列表(0条)